diff --git a/.github/coverage-minimums.json b/.github/coverage-minimums.json index 5421d6e..17805b4 100644 --- a/.github/coverage-minimums.json +++ b/.github/coverage-minimums.json @@ -1,4 +1,3 @@ { - "github.com/batchstream/sink-go": 84, - "github.com/batchstream/sink-go/uri": 91 + "github.com/batchstream/sink-go": 84 } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40f0999..325661d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,10 @@ jobs: - name: Fuzz canonical URI boundaries run: | mkdir -p .reports/fuzz - go test ./uri -run='^$' -fuzz='^FuzzCanonicalURI$' -fuzztime=30s -parallel=2 2>&1 | tee .reports/fuzz/uri.log + protocol_dir="$(go list -m -f '{{.Dir}}' github.com/batchstream/sink-protocol)" + fuzz_dir="$(mktemp -d)" + cp -R "${protocol_dir}/uri/." "${fuzz_dir}/" + (cd "${fuzz_dir}" && GO111MODULE=off go test -run='^$' -fuzz='^FuzzCanonicalURI$' -fuzztime=30s -parallel=2 .) 2>&1 | tee .reports/fuzz/uri.log grep -q 'new interesting:' .reports/fuzz/uri.log - name: Preserve fuzz evidence @@ -60,7 +63,6 @@ jobs: name: uri-fuzzing path: | .reports/fuzz/ - uri/testdata/fuzz/ include-hidden-files: true retention-days: 14 @@ -102,11 +104,6 @@ jobs: go-version-file: go.mod cache: true - - name: Verify matching protobuf contract - run: | - sed 's#github.com/batchstream/sink/gen/sink;sink#github.com/batchstream/sink-go/api/sink/v1;sinkv1#' \ - sink-server/proto/sink/sink.proto | diff -u - proto/sink/sink.proto - - name: Start Sink with MongoDB and Kafka run: docker compose --file sink-server/examples/quickstart/compose.yaml up --detach --build engine worker gateway diff --git a/Makefile b/Makefile index aa3561f..8b983e6 100644 --- a/Makefile +++ b/Makefile @@ -1,29 +1,8 @@ -.PHONY: proto proto-check test test-race test-integration lint clean +.PHONY: test test-race test-integration lint clean BIN_DIR := $(CURDIR)/.bin -PROTOC_GEN_GO_VERSION := v1.36.6 -PROTOC_GEN_GO_GRPC_VERSION := v1.5.1 -PROTOC_GEN_GO_VTPROTO_VERSION := v0.6.1-0.20240319094008-0393e58bdf10 STATICCHECK_VERSION := v0.8.1 -proto: - @mkdir -p $(BIN_DIR) - GOBIN=$(BIN_DIR) go install google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOC_GEN_GO_VERSION) - GOBIN=$(BIN_DIR) go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$(PROTOC_GEN_GO_GRPC_VERSION) - GOBIN=$(BIN_DIR) go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@$(PROTOC_GEN_GO_VTPROTO_VERSION) - PATH="$(BIN_DIR):$$PATH" protoc \ - --proto_path=proto \ - --go_out=. --go_opt=module=github.com/batchstream/sink-go \ - --go-grpc_out=. --go-grpc_opt=module=github.com/batchstream/sink-go \ - --go-vtproto_out=. --go-vtproto_opt=module=github.com/batchstream/sink-go,features=marshal+unmarshal+size \ - proto/sink/sink.proto - @perl -0pi -e 's/\treturn &sinkClient\{cc\}\n/\tclient := \&sinkClient{cc}\n\treturn client\n/' api/sink/v1/sink_grpc.pb.go - @perl -0pi -e 's/^(\s*)m\.([A-Za-z]+) = append\(m\.\2, &([A-Za-z]+)\{\}\)\n/$$1item := \&$${3}{}\n$$1m.$$2 = append(m.$$2, item)\n/gm' api/sink/v1/sink_vtproto.pb.go - @gofmt -w api/sink/v1/sink_grpc.pb.go api/sink/v1/sink_vtproto.pb.go - -proto-check: proto - git diff --exit-code -- api/sink/v1 - test: go test ./... -count=1 diff --git a/README.md b/README.md index 59030e0..aa96867 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ canonical URI for Engine affinity. All Gateways with the same Engine membership select the same Engine for a record. Membership changes may temporarily split traffic. No exclusive ownership or cross-replica ordering is promised. -The shared `github.com/batchstream/sink-go/uri` package builds, parses and validates +The shared `github.com/batchstream/sink-protocol/uri` package builds, parses and validates URIs. String keys use `s:`, int64 keys `i:`, bytes keys `b:` plus unpadded base64url, and opaque keys `o::`. The builder escapes each path segment; encoded slashes are part of a segment. Alternate URI spellings, @@ -299,7 +299,7 @@ The default collector returns received documents/results along with any error. search hits, with an opaque `NextCursor` for resuming on any server. - String, int64, byte, and opaque keys are supported. - `CheckHealth` uses the standard gRPC health service. -- `Raw` exposes the generated `api/sink/v1` client for advanced use. +- `Raw` exposes the generated `github.com/batchstream/sink-protocol/sink/v1` client for advanced use. Use `CompletionWaitUntilApplied` for storage acknowledgement, `CompletionWaitUntilVisible` when a following search read must observe the @@ -734,19 +734,18 @@ Use matching SDK and server protocols. A missing requested write document is a `ProtocolError` after the write may already have been applied, so it must not trigger an automatic retry. -The generated protocol matches the current Sink server contract. CI -runs descriptor contract tests, race-enabled unit tests against an in-memory +The SDK uses the generated public API from `sink-protocol`, the same versioned +contract consumed by the Sink server. CI runs race-enabled unit tests against an in-memory gRPC server, malformed-response tests, static analysis, and an end-to-end integration test against the matching Sink branch when available, or main, with MongoDB and Kafka. -The compatibility workflow also runs weekly so server-side drift is detected +The compatibility workflow also runs weekly to detect server-side behavior drift without requiring a client commit. ```shell make test make test-race make lint -make proto-check ``` To run the external compatibility test against an already running server: diff --git a/api/sink/v1/doc.go b/api/sink/v1/doc.go deleted file mode 100644 index 26154b0..0000000 --- a/api/sink/v1/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package sinkv1 contains generated protobuf definitions for the Sink v1 gRPC -// service. -package sinkv1 diff --git a/api/sink/v1/sink.pb.go b/api/sink/v1/sink.pb.go deleted file mode 100644 index bcf3766..0000000 --- a/api/sink/v1/sink.pb.go +++ /dev/null @@ -1,2553 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.6 -// protoc v6.33.4 -// source: sink/sink.proto - -package sinkv1 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type DocumentEncoding int32 - -const ( - DocumentEncoding_DOCUMENT_ENCODING_UNSPECIFIED DocumentEncoding = 0 - DocumentEncoding_DOCUMENT_ENCODING_JSON DocumentEncoding = 1 - DocumentEncoding_DOCUMENT_ENCODING_BSON DocumentEncoding = 2 -) - -// Enum value maps for DocumentEncoding. -var ( - DocumentEncoding_name = map[int32]string{ - 0: "DOCUMENT_ENCODING_UNSPECIFIED", - 1: "DOCUMENT_ENCODING_JSON", - 2: "DOCUMENT_ENCODING_BSON", - } - DocumentEncoding_value = map[string]int32{ - "DOCUMENT_ENCODING_UNSPECIFIED": 0, - "DOCUMENT_ENCODING_JSON": 1, - "DOCUMENT_ENCODING_BSON": 2, - } -) - -func (x DocumentEncoding) Enum() *DocumentEncoding { - p := new(DocumentEncoding) - *p = x - return p -} - -func (x DocumentEncoding) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (DocumentEncoding) Descriptor() protoreflect.EnumDescriptor { - return file_sink_sink_proto_enumTypes[0].Descriptor() -} - -func (DocumentEncoding) Type() protoreflect.EnumType { - return &file_sink_sink_proto_enumTypes[0] -} - -func (x DocumentEncoding) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use DocumentEncoding.Descriptor instead. -func (DocumentEncoding) EnumDescriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{0} -} - -// CompletionMode defines the point at which a mutating RPC returns success. -type CompletionMode int32 - -const ( - CompletionMode_COMPLETION_MODE_UNSPECIFIED CompletionMode = 0 - // Wait until the storage adapter has applied each operation. - CompletionMode_COMPLETION_MODE_WAIT_UNTIL_APPLIED CompletionMode = 1 - // Return after a durable asynchronous queue has accepted each operation. - // Acceptance does not mean that the storage adapter has applied it. - CompletionMode_COMPLETION_MODE_RETURN_AFTER_ACCEPTED CompletionMode = 2 - // Wait until the storage adapter has applied each operation and made the - // result visible to subsequent reads. Search adapters use refresh=wait_for. - CompletionMode_COMPLETION_MODE_WAIT_UNTIL_VISIBLE CompletionMode = 3 -) - -// Enum value maps for CompletionMode. -var ( - CompletionMode_name = map[int32]string{ - 0: "COMPLETION_MODE_UNSPECIFIED", - 1: "COMPLETION_MODE_WAIT_UNTIL_APPLIED", - 2: "COMPLETION_MODE_RETURN_AFTER_ACCEPTED", - 3: "COMPLETION_MODE_WAIT_UNTIL_VISIBLE", - } - CompletionMode_value = map[string]int32{ - "COMPLETION_MODE_UNSPECIFIED": 0, - "COMPLETION_MODE_WAIT_UNTIL_APPLIED": 1, - "COMPLETION_MODE_RETURN_AFTER_ACCEPTED": 2, - "COMPLETION_MODE_WAIT_UNTIL_VISIBLE": 3, - } -) - -func (x CompletionMode) Enum() *CompletionMode { - p := new(CompletionMode) - *p = x - return p -} - -func (x CompletionMode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (CompletionMode) Descriptor() protoreflect.EnumDescriptor { - return file_sink_sink_proto_enumTypes[1].Descriptor() -} - -func (CompletionMode) Type() protoreflect.EnumType { - return &file_sink_sink_proto_enumTypes[1] -} - -func (x CompletionMode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use CompletionMode.Descriptor instead. -func (CompletionMode) EnumDescriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{1} -} - -type ReadStatus int32 - -const ( - ReadStatus_READ_STATUS_UNSPECIFIED ReadStatus = 0 - ReadStatus_READ_STATUS_FOUND ReadStatus = 1 - ReadStatus_READ_STATUS_NOT_FOUND ReadStatus = 2 - ReadStatus_READ_STATUS_FAILED ReadStatus = 3 -) - -// Enum value maps for ReadStatus. -var ( - ReadStatus_name = map[int32]string{ - 0: "READ_STATUS_UNSPECIFIED", - 1: "READ_STATUS_FOUND", - 2: "READ_STATUS_NOT_FOUND", - 3: "READ_STATUS_FAILED", - } - ReadStatus_value = map[string]int32{ - "READ_STATUS_UNSPECIFIED": 0, - "READ_STATUS_FOUND": 1, - "READ_STATUS_NOT_FOUND": 2, - "READ_STATUS_FAILED": 3, - } -) - -func (x ReadStatus) Enum() *ReadStatus { - p := new(ReadStatus) - *p = x - return p -} - -func (x ReadStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ReadStatus) Descriptor() protoreflect.EnumDescriptor { - return file_sink_sink_proto_enumTypes[2].Descriptor() -} - -func (ReadStatus) Type() protoreflect.EnumType { - return &file_sink_sink_proto_enumTypes[2] -} - -func (x ReadStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ReadStatus.Descriptor instead. -func (ReadStatus) EnumDescriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{2} -} - -type WriteMode int32 - -const ( - WriteMode_WRITE_MODE_UNSPECIFIED WriteMode = 0 - WriteMode_WRITE_MODE_CREATE WriteMode = 1 - WriteMode_WRITE_MODE_REPLACE WriteMode = 2 - WriteMode_WRITE_MODE_UPSERT WriteMode = 3 -) - -// Enum value maps for WriteMode. -var ( - WriteMode_name = map[int32]string{ - 0: "WRITE_MODE_UNSPECIFIED", - 1: "WRITE_MODE_CREATE", - 2: "WRITE_MODE_REPLACE", - 3: "WRITE_MODE_UPSERT", - } - WriteMode_value = map[string]int32{ - "WRITE_MODE_UNSPECIFIED": 0, - "WRITE_MODE_CREATE": 1, - "WRITE_MODE_REPLACE": 2, - "WRITE_MODE_UPSERT": 3, - } -) - -func (x WriteMode) Enum() *WriteMode { - p := new(WriteMode) - *p = x - return p -} - -func (x WriteMode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (WriteMode) Descriptor() protoreflect.EnumDescriptor { - return file_sink_sink_proto_enumTypes[3].Descriptor() -} - -func (WriteMode) Type() protoreflect.EnumType { - return &file_sink_sink_proto_enumTypes[3] -} - -func (x WriteMode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use WriteMode.Descriptor instead. -func (WriteMode) EnumDescriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{3} -} - -type WriteStatus int32 - -const ( - WriteStatus_WRITE_STATUS_UNSPECIFIED WriteStatus = 0 - // The asynchronous queue accepted the operation durably. - WriteStatus_WRITE_STATUS_ACCEPTED WriteStatus = 1 - // The storage adapter applied the operation. - WriteStatus_WRITE_STATUS_APPLIED WriteStatus = 2 - // A CREATE, REPLACE, or adapter-level revision condition did not match. - WriteStatus_WRITE_STATUS_PRECONDITION_FAILED WriteStatus = 3 - WriteStatus_WRITE_STATUS_FAILED WriteStatus = 4 -) - -// Enum value maps for WriteStatus. -var ( - WriteStatus_name = map[int32]string{ - 0: "WRITE_STATUS_UNSPECIFIED", - 1: "WRITE_STATUS_ACCEPTED", - 2: "WRITE_STATUS_APPLIED", - 3: "WRITE_STATUS_PRECONDITION_FAILED", - 4: "WRITE_STATUS_FAILED", - } - WriteStatus_value = map[string]int32{ - "WRITE_STATUS_UNSPECIFIED": 0, - "WRITE_STATUS_ACCEPTED": 1, - "WRITE_STATUS_APPLIED": 2, - "WRITE_STATUS_PRECONDITION_FAILED": 3, - "WRITE_STATUS_FAILED": 4, - } -) - -func (x WriteStatus) Enum() *WriteStatus { - p := new(WriteStatus) - *p = x - return p -} - -func (x WriteStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (WriteStatus) Descriptor() protoreflect.EnumDescriptor { - return file_sink_sink_proto_enumTypes[4].Descriptor() -} - -func (WriteStatus) Type() protoreflect.EnumType { - return &file_sink_sink_proto_enumTypes[4] -} - -func (x WriteStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use WriteStatus.Descriptor instead. -func (WriteStatus) EnumDescriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{4} -} - -type DeleteStatus int32 - -const ( - DeleteStatus_DELETE_STATUS_UNSPECIFIED DeleteStatus = 0 - DeleteStatus_DELETE_STATUS_ACCEPTED DeleteStatus = 1 - DeleteStatus_DELETE_STATUS_APPLIED DeleteStatus = 2 - DeleteStatus_DELETE_STATUS_FAILED DeleteStatus = 3 -) - -// Enum value maps for DeleteStatus. -var ( - DeleteStatus_name = map[int32]string{ - 0: "DELETE_STATUS_UNSPECIFIED", - 1: "DELETE_STATUS_ACCEPTED", - 2: "DELETE_STATUS_APPLIED", - 3: "DELETE_STATUS_FAILED", - } - DeleteStatus_value = map[string]int32{ - "DELETE_STATUS_UNSPECIFIED": 0, - "DELETE_STATUS_ACCEPTED": 1, - "DELETE_STATUS_APPLIED": 2, - "DELETE_STATUS_FAILED": 3, - } -) - -func (x DeleteStatus) Enum() *DeleteStatus { - p := new(DeleteStatus) - *p = x - return p -} - -func (x DeleteStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (DeleteStatus) Descriptor() protoreflect.EnumDescriptor { - return file_sink_sink_proto_enumTypes[5].Descriptor() -} - -func (DeleteStatus) Type() protoreflect.EnumType { - return &file_sink_sink_proto_enumTypes[5] -} - -func (x DeleteStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use DeleteStatus.Descriptor instead. -func (DeleteStatus) EnumDescriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{5} -} - -type FailureCode int32 - -const ( - FailureCode_FAILURE_CODE_UNSPECIFIED FailureCode = 0 - FailureCode_FAILURE_CODE_INVALID_ARGUMENT FailureCode = 1 - FailureCode_FAILURE_CODE_PRECONDITION_FAILED FailureCode = 2 - FailureCode_FAILURE_CODE_NOT_FOUND FailureCode = 3 - FailureCode_FAILURE_CODE_CONFLICT FailureCode = 4 - FailureCode_FAILURE_CODE_RESOURCE_EXHAUSTED FailureCode = 5 - FailureCode_FAILURE_CODE_UNAVAILABLE FailureCode = 6 - FailureCode_FAILURE_CODE_DEADLINE_EXCEEDED FailureCode = 7 - FailureCode_FAILURE_CODE_INTERNAL FailureCode = 8 -) - -// Enum value maps for FailureCode. -var ( - FailureCode_name = map[int32]string{ - 0: "FAILURE_CODE_UNSPECIFIED", - 1: "FAILURE_CODE_INVALID_ARGUMENT", - 2: "FAILURE_CODE_PRECONDITION_FAILED", - 3: "FAILURE_CODE_NOT_FOUND", - 4: "FAILURE_CODE_CONFLICT", - 5: "FAILURE_CODE_RESOURCE_EXHAUSTED", - 6: "FAILURE_CODE_UNAVAILABLE", - 7: "FAILURE_CODE_DEADLINE_EXCEEDED", - 8: "FAILURE_CODE_INTERNAL", - } - FailureCode_value = map[string]int32{ - "FAILURE_CODE_UNSPECIFIED": 0, - "FAILURE_CODE_INVALID_ARGUMENT": 1, - "FAILURE_CODE_PRECONDITION_FAILED": 2, - "FAILURE_CODE_NOT_FOUND": 3, - "FAILURE_CODE_CONFLICT": 4, - "FAILURE_CODE_RESOURCE_EXHAUSTED": 5, - "FAILURE_CODE_UNAVAILABLE": 6, - "FAILURE_CODE_DEADLINE_EXCEEDED": 7, - "FAILURE_CODE_INTERNAL": 8, - } -) - -func (x FailureCode) Enum() *FailureCode { - p := new(FailureCode) - *p = x - return p -} - -func (x FailureCode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (FailureCode) Descriptor() protoreflect.EnumDescriptor { - return file_sink_sink_proto_enumTypes[6].Descriptor() -} - -func (FailureCode) Type() protoreflect.EnumType { - return &file_sink_sink_proto_enumTypes[6] -} - -func (x FailureCode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use FailureCode.Descriptor instead. -func (FailureCode) EnumDescriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{6} -} - -// RecordAddress is a canonical sink:/// URI. The core treats the -// path as opaque; each Store adapter owns its path grammar. The full canonical -// URI is the record identity for routing, batching, and durable delivery. -type RecordAddress struct { - state protoimpl.MessageState `protogen:"open.v1"` - Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RecordAddress) Reset() { - *x = RecordAddress{} - mi := &file_sink_sink_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RecordAddress) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RecordAddress) ProtoMessage() {} - -func (x *RecordAddress) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RecordAddress.ProtoReflect.Descriptor instead. -func (*RecordAddress) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{0} -} - -func (x *RecordAddress) GetUri() string { - if x != nil { - return x.Uri - } - return "" -} - -// Document contains one explicitly encoded user object. Callers select JSON -// for search storage and BSON for MongoDB storage. -type Document struct { - state protoimpl.MessageState `protogen:"open.v1"` - Encoding DocumentEncoding `protobuf:"varint,1,opt,name=encoding,proto3,enum=sink.v1.DocumentEncoding" json:"encoding,omitempty"` - Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Document) Reset() { - *x = Document{} - mi := &file_sink_sink_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Document) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Document) ProtoMessage() {} - -func (x *Document) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Document.ProtoReflect.Descriptor instead. -func (*Document) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{1} -} - -func (x *Document) GetEncoding() DocumentEncoding { - if x != nil { - return x.Encoding - } - return DocumentEncoding_DOCUMENT_ENCODING_UNSPECIFIED -} - -func (x *Document) GetPayload() []byte { - if x != nil { - return x.Payload - } - return nil -} - -type ReadRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Operations []*ReadOperation `protobuf:"bytes,1,rep,name=operations,proto3" json:"operations,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ReadRequest) Reset() { - *x = ReadRequest{} - mi := &file_sink_sink_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ReadRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadRequest) ProtoMessage() {} - -func (x *ReadRequest) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead. -func (*ReadRequest) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{2} -} - -func (x *ReadRequest) GetOperations() []*ReadOperation { - if x != nil { - return x.Operations - } - return nil -} - -type ReadOperation struct { - state protoimpl.MessageState `protogen:"open.v1"` - Address *RecordAddress `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ReadOperation) Reset() { - *x = ReadOperation{} - mi := &file_sink_sink_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ReadOperation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadOperation) ProtoMessage() {} - -func (x *ReadOperation) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReadOperation.ProtoReflect.Descriptor instead. -func (*ReadOperation) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{3} -} - -func (x *ReadOperation) GetAddress() *RecordAddress { - if x != nil { - return x.Address - } - return nil -} - -type ReadResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Each frame contains one result. Results may arrive out of order; correlate - // by operation_index. Successful EOF requires exactly one result per operation. - Results []*ReadResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ReadResponse) Reset() { - *x = ReadResponse{} - mi := &file_sink_sink_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ReadResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadResponse) ProtoMessage() {} - -func (x *ReadResponse) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead. -func (*ReadResponse) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{4} -} - -func (x *ReadResponse) GetResults() []*ReadResult { - if x != nil { - return x.Results - } - return nil -} - -type ReadResult struct { - state protoimpl.MessageState `protogen:"open.v1"` - OperationIndex uint32 `protobuf:"varint,1,opt,name=operation_index,json=operationIndex,proto3" json:"operation_index,omitempty"` - Status ReadStatus `protobuf:"varint,2,opt,name=status,proto3,enum=sink.v1.ReadStatus" json:"status,omitempty"` - Document *Document `protobuf:"bytes,3,opt,name=document,proto3" json:"document,omitempty"` - Failure *Failure `protobuf:"bytes,5,opt,name=failure,proto3" json:"failure,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ReadResult) Reset() { - *x = ReadResult{} - mi := &file_sink_sink_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ReadResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadResult) ProtoMessage() {} - -func (x *ReadResult) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReadResult.ProtoReflect.Descriptor instead. -func (*ReadResult) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{5} -} - -func (x *ReadResult) GetOperationIndex() uint32 { - if x != nil { - return x.OperationIndex - } - return 0 -} - -func (x *ReadResult) GetStatus() ReadStatus { - if x != nil { - return x.Status - } - return ReadStatus_READ_STATUS_UNSPECIFIED -} - -func (x *ReadResult) GetDocument() *Document { - if x != nil { - return x.Document - } - return nil -} - -func (x *ReadResult) GetFailure() *Failure { - if x != nil { - return x.Failure - } - return nil -} - -type WriteRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - CompletionMode CompletionMode `protobuf:"varint,1,opt,name=completion_mode,json=completionMode,proto3,enum=sink.v1.CompletionMode" json:"completion_mode,omitempty"` - // Operations for the same address are executed in request order. Operations - // for different addresses may execute concurrently. - Operations []*WriteOperation `protobuf:"bytes,2,rep,name=operations,proto3" json:"operations,omitempty"` - // Programs can be declared once and referenced by digest from multiple merge - // operations, avoiding repeated Lua source bytes in a synchronous batch. - LuaPrograms []*LuaProgram `protobuf:"bytes,3,rep,name=lua_programs,json=luaPrograms,proto3" json:"lua_programs,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *WriteRequest) Reset() { - *x = WriteRequest{} - mi := &file_sink_sink_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *WriteRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteRequest) ProtoMessage() {} - -func (x *WriteRequest) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WriteRequest.ProtoReflect.Descriptor instead. -func (*WriteRequest) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{6} -} - -func (x *WriteRequest) GetCompletionMode() CompletionMode { - if x != nil { - return x.CompletionMode - } - return CompletionMode_COMPLETION_MODE_UNSPECIFIED -} - -func (x *WriteRequest) GetOperations() []*WriteOperation { - if x != nil { - return x.Operations - } - return nil -} - -func (x *WriteRequest) GetLuaPrograms() []*LuaProgram { - if x != nil { - return x.LuaPrograms - } - return nil -} - -type WriteOperation struct { - state protoimpl.MessageState `protogen:"open.v1"` - Address *RecordAddress `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Types that are valid to be assigned to Action: - // - // *WriteOperation_Put - // *WriteOperation_Merge - Action isWriteOperation_Action `protobuf_oneof:"action"` - // Return the logical document submitted by this operation after its commit. - // Only synchronous completion modes support this. These operations do not - // share a folded commit with preceding or following operations. - ReturnDocument bool `protobuf:"varint,4,opt,name=return_document,json=returnDocument,proto3" json:"return_document,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *WriteOperation) Reset() { - *x = WriteOperation{} - mi := &file_sink_sink_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *WriteOperation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteOperation) ProtoMessage() {} - -func (x *WriteOperation) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WriteOperation.ProtoReflect.Descriptor instead. -func (*WriteOperation) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{7} -} - -func (x *WriteOperation) GetAddress() *RecordAddress { - if x != nil { - return x.Address - } - return nil -} - -func (x *WriteOperation) GetAction() isWriteOperation_Action { - if x != nil { - return x.Action - } - return nil -} - -func (x *WriteOperation) GetPut() *PutOperation { - if x != nil { - if x, ok := x.Action.(*WriteOperation_Put); ok { - return x.Put - } - } - return nil -} - -func (x *WriteOperation) GetMerge() *MergeOperation { - if x != nil { - if x, ok := x.Action.(*WriteOperation_Merge); ok { - return x.Merge - } - } - return nil -} - -func (x *WriteOperation) GetReturnDocument() bool { - if x != nil { - return x.ReturnDocument - } - return false -} - -type isWriteOperation_Action interface { - isWriteOperation_Action() -} - -type WriteOperation_Put struct { - Put *PutOperation `protobuf:"bytes,2,opt,name=put,proto3,oneof"` -} - -type WriteOperation_Merge struct { - Merge *MergeOperation `protobuf:"bytes,3,opt,name=merge,proto3,oneof"` -} - -func (*WriteOperation_Put) isWriteOperation_Action() {} - -func (*WriteOperation_Merge) isWriteOperation_Action() {} - -// PutOperation writes a complete user document without interpreting its fields. -type PutOperation struct { - state protoimpl.MessageState `protogen:"open.v1"` - Document *Document `protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"` - Mode WriteMode `protobuf:"varint,2,opt,name=mode,proto3,enum=sink.v1.WriteMode" json:"mode,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *PutOperation) Reset() { - *x = PutOperation{} - mi := &file_sink_sink_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *PutOperation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutOperation) ProtoMessage() {} - -func (x *PutOperation) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PutOperation.ProtoReflect.Descriptor instead. -func (*PutOperation) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{8} -} - -func (x *PutOperation) GetDocument() *Document { - if x != nil { - return x.Document - } - return nil -} - -func (x *PutOperation) GetMode() WriteMode { - if x != nil { - return x.Mode - } - return WriteMode_WRITE_MODE_UNSPECIFIED -} - -// MergeOperation carries the original merge intent. In asynchronous mode Sink -// expands any program reference before queueing the operation so the worker can -// merge against the document version it reads at execution time. -type MergeOperation struct { - state protoimpl.MessageState `protogen:"open.v1"` - IncomingDocument *Document `protobuf:"bytes,1,opt,name=incoming_document,json=incomingDocument,proto3" json:"incoming_document,omitempty"` - LuaProgram *LuaProgram `protobuf:"bytes,2,opt,name=lua_program,json=luaProgram,proto3" json:"lua_program,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *MergeOperation) Reset() { - *x = MergeOperation{} - mi := &file_sink_sink_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *MergeOperation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MergeOperation) ProtoMessage() {} - -func (x *MergeOperation) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MergeOperation.ProtoReflect.Descriptor instead. -func (*MergeOperation) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{9} -} - -func (x *MergeOperation) GetIncomingDocument() *Document { - if x != nil { - return x.IncomingDocument - } - return nil -} - -func (x *MergeOperation) GetLuaProgram() *LuaProgram { - if x != nil { - return x.LuaProgram - } - return nil -} - -// LuaProgram is self-contained so merge rules can be versioned and deployed -// with the calling application instead of being registered in Sink. -type LuaProgram struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Source may be omitted from a merge operation when the matching full program - // is present in WriteRequest.lua_programs. Workers always receive full source. - Source []byte `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` - // Optional SHA-256 digest. Sink verifies it when present and always uses the - // computed digest as the compiled-program cache key. - Sha256 []byte `protobuf:"bytes,2,opt,name=sha256,proto3" json:"sha256,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LuaProgram) Reset() { - *x = LuaProgram{} - mi := &file_sink_sink_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LuaProgram) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LuaProgram) ProtoMessage() {} - -func (x *LuaProgram) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LuaProgram.ProtoReflect.Descriptor instead. -func (*LuaProgram) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{10} -} - -func (x *LuaProgram) GetSource() []byte { - if x != nil { - return x.Source - } - return nil -} - -func (x *LuaProgram) GetSha256() []byte { - if x != nil { - return x.Sha256 - } - return nil -} - -// Each frame contains one final result, identified by operation_index. -// A disconnected stream does not establish the outcome of missing operations. -type WriteResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Results []*WriteResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *WriteResponse) Reset() { - *x = WriteResponse{} - mi := &file_sink_sink_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *WriteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteResponse) ProtoMessage() {} - -func (x *WriteResponse) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WriteResponse.ProtoReflect.Descriptor instead. -func (*WriteResponse) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{11} -} - -func (x *WriteResponse) GetResults() []*WriteResult { - if x != nil { - return x.Results - } - return nil -} - -type WriteResult struct { - state protoimpl.MessageState `protogen:"open.v1"` - OperationIndex uint32 `protobuf:"varint,1,opt,name=operation_index,json=operationIndex,proto3" json:"operation_index,omitempty"` - Status WriteStatus `protobuf:"varint,2,opt,name=status,proto3,enum=sink.v1.WriteStatus" json:"status,omitempty"` - Failure *Failure `protobuf:"bytes,4,opt,name=failure,proto3" json:"failure,omitempty"` - Document *Document `protobuf:"bytes,5,opt,name=document,proto3" json:"document,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *WriteResult) Reset() { - *x = WriteResult{} - mi := &file_sink_sink_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *WriteResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteResult) ProtoMessage() {} - -func (x *WriteResult) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[12] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WriteResult.ProtoReflect.Descriptor instead. -func (*WriteResult) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{12} -} - -func (x *WriteResult) GetOperationIndex() uint32 { - if x != nil { - return x.OperationIndex - } - return 0 -} - -func (x *WriteResult) GetStatus() WriteStatus { - if x != nil { - return x.Status - } - return WriteStatus_WRITE_STATUS_UNSPECIFIED -} - -func (x *WriteResult) GetFailure() *Failure { - if x != nil { - return x.Failure - } - return nil -} - -func (x *WriteResult) GetDocument() *Document { - if x != nil { - return x.Document - } - return nil -} - -type DeleteRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - CompletionMode CompletionMode `protobuf:"varint,1,opt,name=completion_mode,json=completionMode,proto3,enum=sink.v1.CompletionMode" json:"completion_mode,omitempty"` - // Deletes are hard deletes. Deleting an absent record is successful. - Operations []*DeleteOperation `protobuf:"bytes,2,rep,name=operations,proto3" json:"operations,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteRequest) Reset() { - *x = DeleteRequest{} - mi := &file_sink_sink_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteRequest) ProtoMessage() {} - -func (x *DeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. -func (*DeleteRequest) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{13} -} - -func (x *DeleteRequest) GetCompletionMode() CompletionMode { - if x != nil { - return x.CompletionMode - } - return CompletionMode_COMPLETION_MODE_UNSPECIFIED -} - -func (x *DeleteRequest) GetOperations() []*DeleteOperation { - if x != nil { - return x.Operations - } - return nil -} - -type DeleteOperation struct { - state protoimpl.MessageState `protogen:"open.v1"` - Address *RecordAddress `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteOperation) Reset() { - *x = DeleteOperation{} - mi := &file_sink_sink_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteOperation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteOperation) ProtoMessage() {} - -func (x *DeleteOperation) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[14] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteOperation.ProtoReflect.Descriptor instead. -func (*DeleteOperation) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{14} -} - -func (x *DeleteOperation) GetAddress() *RecordAddress { - if x != nil { - return x.Address - } - return nil -} - -type DeleteResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Results []*DeleteResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteResponse) Reset() { - *x = DeleteResponse{} - mi := &file_sink_sink_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteResponse) ProtoMessage() {} - -func (x *DeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[15] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. -func (*DeleteResponse) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{15} -} - -func (x *DeleteResponse) GetResults() []*DeleteResult { - if x != nil { - return x.Results - } - return nil -} - -type DeleteResult struct { - state protoimpl.MessageState `protogen:"open.v1"` - OperationIndex uint32 `protobuf:"varint,1,opt,name=operation_index,json=operationIndex,proto3" json:"operation_index,omitempty"` - Status DeleteStatus `protobuf:"varint,2,opt,name=status,proto3,enum=sink.v1.DeleteStatus" json:"status,omitempty"` - Failure *Failure `protobuf:"bytes,3,opt,name=failure,proto3" json:"failure,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteResult) Reset() { - *x = DeleteResult{} - mi := &file_sink_sink_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteResult) ProtoMessage() {} - -func (x *DeleteResult) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[16] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteResult.ProtoReflect.Descriptor instead. -func (*DeleteResult) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{16} -} - -func (x *DeleteResult) GetOperationIndex() uint32 { - if x != nil { - return x.OperationIndex - } - return 0 -} - -func (x *DeleteResult) GetStatus() DeleteStatus { - if x != nil { - return x.Status - } - return DeleteStatus_DELETE_STATUS_UNSPECIFIED -} - -func (x *DeleteResult) GetFailure() *Failure { - if x != nil { - return x.Failure - } - return nil -} - -type Failure struct { - state protoimpl.MessageState `protogen:"open.v1"` - Code FailureCode `protobuf:"varint,1,opt,name=code,proto3,enum=sink.v1.FailureCode" json:"code,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - Retryable bool `protobuf:"varint,3,opt,name=retryable,proto3" json:"retryable,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Failure) Reset() { - *x = Failure{} - mi := &file_sink_sink_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Failure) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Failure) ProtoMessage() {} - -func (x *Failure) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[17] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Failure.ProtoReflect.Descriptor instead. -func (*Failure) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{17} -} - -func (x *Failure) GetCode() FailureCode { - if x != nil { - return x.Code - } - return FailureCode_FAILURE_CODE_UNSPECIFIED -} - -func (x *Failure) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *Failure) GetRetryable() bool { - if x != nil { - return x.Retryable - } - return false -} - -// Command is shared by Execute, Query, Count and Scan. The canonical URI selects -// a configured Store; only its adapter interprets the remaining path. -// MongoDB uses sink://store/database[/collection] with an ordered BSON payload. -// HTTP search uses sink://store/index with a separate native operation path, -// such as /_search, method, query, headers and body. A Store root is -// spelled sink://store. Endpoints and authentication come from configuration. -type Command struct { - state protoimpl.MessageState `protogen:"open.v1"` - Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"` - // Native request method, such as GET or POST. Unused by MongoDB. - Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` - // Operation path relative to the URI resource, e.g. /_search or /_mapping. - // Unused by MongoDB; its operation is carried by the BSON command. - Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` - // URL-encoded query parameters without a leading '?'; repeated keys are valid. - Query string `protobuf:"bytes,4,opt,name=query,proto3" json:"query,omitempty"` - // Authentication and transport-owned headers remain server-controlled. - // Set Content-Type using content_type, not headers. - Headers []*Header `protobuf:"bytes,5,rep,name=headers,proto3" json:"headers,omitempty"` - // Payload media type. Required when payload is nonempty. - ContentType string `protobuf:"bytes,6,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - // Original ordered command or request body, without a Sink-specific envelope. - Payload []byte `protobuf:"bytes,7,opt,name=payload,proto3" json:"payload,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Command) Reset() { - *x = Command{} - mi := &file_sink_sink_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Command) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Command) ProtoMessage() {} - -func (x *Command) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[18] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Command.ProtoReflect.Descriptor instead. -func (*Command) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{18} -} - -func (x *Command) GetUri() string { - if x != nil { - return x.Uri - } - return "" -} - -func (x *Command) GetMethod() string { - if x != nil { - return x.Method - } - return "" -} - -func (x *Command) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *Command) GetQuery() string { - if x != nil { - return x.Query - } - return "" -} - -func (x *Command) GetHeaders() []*Header { - if x != nil { - return x.Headers - } - return nil -} - -func (x *Command) GetContentType() string { - if x != nil { - return x.ContentType - } - return "" -} - -func (x *Command) GetPayload() []byte { - if x != nil { - return x.Payload - } - return nil -} - -type Header struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Header) Reset() { - *x = Header{} - mi := &file_sink_sink_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Header) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Header) ProtoMessage() {} - -func (x *Header) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[19] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Header.ProtoReflect.Descriptor instead. -func (*Header) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{19} -} - -func (x *Header) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Header) GetValues() []string { - if x != nil { - return x.Values - } - return nil -} - -// Execute performs one native interaction. It does not provide cross-RPC -// session affinity. Adapters reject commands requiring session affinity or a -// client-managed session; supported cursor queries use Scan instead. -// Each adapter validates its supported operations before forwarding. MongoDB -// protects revisions on supported writes; HTTP search rejects index lifecycle -// and alias management, including unknown administrative write endpoints. -// -// Permitted writes retain backend semantics subject to adapter safeguards. They -// do not run Lua merges, record batching or asynchronous completion. Neither -// Sink nor its SDK should automatically replay Execute after an unknown outcome. -type ExecuteRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Command *Command `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ExecuteRequest) Reset() { - *x = ExecuteRequest{} - mi := &file_sink_sink_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ExecuteRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExecuteRequest) ProtoMessage() {} - -func (x *ExecuteRequest) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[20] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExecuteRequest.ProtoReflect.Descriptor instead. -func (*ExecuteRequest) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{20} -} - -func (x *ExecuteRequest) GetCommand() *Command { - if x != nil { - return x.Command - } - return nil -} - -// A complete native reply retains its original payload, including backend error -// replies. Such replies use gRPC OK with success=false; validation, transport -// and capacity failures use gRPC errors. HTTP replies preserve the status, -// repeated headers and entity bytes; redirects are returned without following. -type ExecuteResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - ContentType string `protobuf:"bytes,1,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` - // Native command success, or HTTP 2xx. Callers must still inspect item-level - // failures in batch responses. Document commands also check native write and - // write-concern errors. - Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"` - // Native transport status when available; zero means no such status exists. - StatusCode uint32 `protobuf:"varint,4,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"` - Headers []*Header `protobuf:"bytes,5,rep,name=headers,proto3" json:"headers,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ExecuteResponse) Reset() { - *x = ExecuteResponse{} - mi := &file_sink_sink_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ExecuteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExecuteResponse) ProtoMessage() {} - -func (x *ExecuteResponse) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[21] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExecuteResponse.ProtoReflect.Descriptor instead. -func (*ExecuteResponse) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{21} -} - -func (x *ExecuteResponse) GetContentType() string { - if x != nil { - return x.ContentType - } - return "" -} - -func (x *ExecuteResponse) GetPayload() []byte { - if x != nil { - return x.Payload - } - return nil -} - -func (x *ExecuteResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -func (x *ExecuteResponse) GetStatusCode() uint32 { - if x != nil { - return x.StatusCode - } - return 0 -} - -func (x *ExecuteResponse) GetHeaders() []*Header { - if x != nil { - return x.Headers - } - return nil -} - -// Query returns an independent page without retaining a cursor between RPCs. -// Supported sources are find/read-only aggregate command documents and HTTP -// _search requests. Documents have the same native result shape as Scan. -// Use a stable native sort with a unique tie-breaker for predictable pages. -// Concurrent changes may shift results; pagination does not provide a snapshot. -type QueryRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Command *Command `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` - // One-based page number; zero selects page 1. Deep pages still incur backend - // offset costs and are subject to the backend's result-window limits. - Page uint32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"` - // Zero selects 100; maximum 1000. Query replaces native find skip/limit and - // HTTP from/size. For aggregate, pagination follows the supplied pipeline. - PageSize uint32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Ordered sort keys. Empty preserves the native sort; nonempty replaces find - // or HTTP sorting. For aggregate, sort follows the supplied pipeline. - Sort []*SortField `protobuf:"bytes,4,rep,name=sort,proto3" json:"sort,omitempty"` - // Absent preserves native projection. Present replaces find projection or - // HTTP _source selection; aggregate applies it after the pipeline and sort, - // before pagination. An empty fields list selects all document fields. - Projection *Projection `protobuf:"bytes,5,opt,name=projection,proto3" json:"projection,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *QueryRequest) Reset() { - *x = QueryRequest{} - mi := &file_sink_sink_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *QueryRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryRequest) ProtoMessage() {} - -func (x *QueryRequest) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[22] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead. -func (*QueryRequest) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{22} -} - -func (x *QueryRequest) GetCommand() *Command { - if x != nil { - return x.Command - } - return nil -} - -func (x *QueryRequest) GetPage() uint32 { - if x != nil { - return x.Page - } - return 0 -} - -func (x *QueryRequest) GetPageSize() uint32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *QueryRequest) GetSort() []*SortField { - if x != nil { - return x.Sort - } - return nil -} - -func (x *QueryRequest) GetProjection() *Projection { - if x != nil { - return x.Projection - } - return nil -} - -type SortField struct { - state protoimpl.MessageState `protogen:"open.v1"` - Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"` - Descending bool `protobuf:"varint,2,opt,name=descending,proto3" json:"descending,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SortField) Reset() { - *x = SortField{} - mi := &file_sink_sink_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SortField) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SortField) ProtoMessage() {} - -func (x *SortField) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[23] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SortField.ProtoReflect.Descriptor instead. -func (*SortField) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{23} -} - -func (x *SortField) GetField() string { - if x != nil { - return x.Field - } - return "" -} - -func (x *SortField) GetDescending() bool { - if x != nil { - return x.Descending - } - return false -} - -// Field names are native document paths (relative to _source for HTTP search). -// HTTP hit metadata is unchanged. Document stores retain their native rules for -// identity-field projection. -// Database-specific computed projections can remain in Command.payload. -type Projection struct { - state protoimpl.MessageState `protogen:"open.v1"` - Fields []string `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty"` - Exclude bool `protobuf:"varint,2,opt,name=exclude,proto3" json:"exclude,omitempty"` // False includes listed fields; true excludes them. - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Projection) Reset() { - *x = Projection{} - mi := &file_sink_sink_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Projection) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Projection) ProtoMessage() {} - -func (x *Projection) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[24] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Projection.ProtoReflect.Descriptor instead. -func (*Projection) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{24} -} - -func (x *Projection) GetFields() []string { - if x != nil { - return x.Fields - } - return nil -} - -func (x *Projection) GetExclude() bool { - if x != nil { - return x.Exclude - } - return false -} - -// Document frames contain one document. A final, document-free frame sets -// complete and has_more. Metadata is valid only after successful EOF. -type QueryResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Documents []*Document `protobuf:"bytes,1,rep,name=documents,proto3" json:"documents,omitempty"` - // Determined by fetching one extra result, not by running Count. Result-window - // limits apply to this extra result too. A byte limit fails the whole request; - // it never produces a silently shortened page. - HasMore bool `protobuf:"varint,2,opt,name=has_more,json=hasMore,proto3" json:"has_more,omitempty"` - Complete bool `protobuf:"varint,3,opt,name=complete,proto3" json:"complete,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *QueryResponse) Reset() { - *x = QueryResponse{} - mi := &file_sink_sink_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *QueryResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryResponse) ProtoMessage() {} - -func (x *QueryResponse) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[25] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead. -func (*QueryResponse) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{25} -} - -func (x *QueryResponse) GetDocuments() []*Document { - if x != nil { - return x.Documents - } - return nil -} - -func (x *QueryResponse) GetHasMore() bool { - if x != nil { - return x.HasMore - } - return false -} - -func (x *QueryResponse) GetComplete() bool { - if x != nil { - return x.Complete - } - return false -} - -// Count is an independent query, not an implicit part of Query. It accepts the -// same sources and counts matches before find/HTTP pagination; for aggregate it -// counts the output of the supplied pipeline. HTTP counts matching documents -// before collapse. Partial or timed-out counts fail the request. -// Count and Query are separate observations and may differ under concurrent writes. -type CountRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // MongoDB find with an absent or empty filter automatically uses collection - // metadata when no options require exact execution. Filtered queries, - // aggregate pipelines and HTTP search counts remain exact. - Command *Command `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CountRequest) Reset() { - *x = CountRequest{} - mi := &file_sink_sink_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CountRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CountRequest) ProtoMessage() {} - -func (x *CountRequest) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[26] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CountRequest.ProtoReflect.Descriptor instead. -func (*CountRequest) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{26} -} - -func (x *CountRequest) GetCommand() *Command { - if x != nil { - return x.Command - } - return nil -} - -type CountResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` - // True when the backend used an estimate instead of counting matching rows. - Estimated bool `protobuf:"varint,2,opt,name=estimated,proto3" json:"estimated,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CountResponse) Reset() { - *x = CountResponse{} - mi := &file_sink_sink_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CountResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CountResponse) ProtoMessage() {} - -func (x *CountResponse) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[27] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CountResponse.ProtoReflect.Descriptor instead. -func (*CountResponse) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{27} -} - -func (x *CountResponse) GetCount() uint64 { - if x != nil { - return x.Count - } - return 0 -} - -func (x *CountResponse) GetEstimated() bool { - if x != nil { - return x.Estimated - } - return false -} - -// Scan returns one live page. Supply the same Command and Projection and pass -// next_cursor back as cursor after processing a page. Cursors carry the seek -// position across server restarts and do not expire; no database session -// survives a request. Task deadlines and checkpoint retention belong to callers. -// Concurrent changes can affect later pages and retries. Scan is not a snapshot. -type ScanRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Command *Command `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` - // Zero selects 100; maximum 1000. The byte limit may produce a smaller page. - BatchSize uint32 `protobuf:"varint,2,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` - // Empty starts a new scan. Treat this continuation marker as opaque; it is - // bound to Command and Projection and is not an authorization credential. - Cursor []byte `protobuf:"bytes,3,opt,name=cursor,proto3" json:"cursor,omitempty"` - // Absent preserves native projection. Present replaces find projection or - // HTTP _source selection. Empty fields selects all document fields. MongoDB - // retains _id internally for continuation even when excluded from results; - // HTTP hit metadata and sort values are unchanged. - Projection *Projection `protobuf:"bytes,4,opt,name=projection,proto3" json:"projection,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ScanRequest) Reset() { - *x = ScanRequest{} - mi := &file_sink_sink_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ScanRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ScanRequest) ProtoMessage() {} - -func (x *ScanRequest) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[28] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ScanRequest.ProtoReflect.Descriptor instead. -func (*ScanRequest) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{28} -} - -func (x *ScanRequest) GetCommand() *Command { - if x != nil { - return x.Command - } - return nil -} - -func (x *ScanRequest) GetBatchSize() uint32 { - if x != nil { - return x.BatchSize - } - return 0 -} - -func (x *ScanRequest) GetCursor() []byte { - if x != nil { - return x.Cursor - } - return nil -} - -func (x *ScanRequest) GetProjection() *Projection { - if x != nil { - return x.Projection - } - return nil -} - -// Documents retain native encodings: BSON documents or complete JSON hits. -// A failed stream may have delivered documents but never a committed page. -// Resume from the last saved cursor with idempotent business processing. -// Document frames contain one document. A final, document-free frame sets -// complete and next_cursor. Checkpoint only after successful EOF. -type ScanResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Documents []*Document `protobuf:"bytes,1,rep,name=documents,proto3" json:"documents,omitempty"` - // Empty means the scan reached the end observed by this request. Commit a - // checkpoint only after processing documents and successful EOF. No close RPC is needed. - NextCursor []byte `protobuf:"bytes,2,opt,name=next_cursor,json=nextCursor,proto3" json:"next_cursor,omitempty"` - Complete bool `protobuf:"varint,3,opt,name=complete,proto3" json:"complete,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ScanResponse) Reset() { - *x = ScanResponse{} - mi := &file_sink_sink_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ScanResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ScanResponse) ProtoMessage() {} - -func (x *ScanResponse) ProtoReflect() protoreflect.Message { - mi := &file_sink_sink_proto_msgTypes[29] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ScanResponse.ProtoReflect.Descriptor instead. -func (*ScanResponse) Descriptor() ([]byte, []int) { - return file_sink_sink_proto_rawDescGZIP(), []int{29} -} - -func (x *ScanResponse) GetDocuments() []*Document { - if x != nil { - return x.Documents - } - return nil -} - -func (x *ScanResponse) GetNextCursor() []byte { - if x != nil { - return x.NextCursor - } - return nil -} - -func (x *ScanResponse) GetComplete() bool { - if x != nil { - return x.Complete - } - return false -} - -var File_sink_sink_proto protoreflect.FileDescriptor - -const file_sink_sink_proto_rawDesc = "" + - "\n" + - "\x0fsink/sink.proto\x12\asink.v1\"!\n" + - "\rRecordAddress\x12\x10\n" + - "\x03uri\x18\x01 \x01(\tR\x03uri\"[\n" + - "\bDocument\x125\n" + - "\bencoding\x18\x01 \x01(\x0e2\x19.sink.v1.DocumentEncodingR\bencoding\x12\x18\n" + - "\apayload\x18\x02 \x01(\fR\apayload\"E\n" + - "\vReadRequest\x126\n" + - "\n" + - "operations\x18\x01 \x03(\v2\x16.sink.v1.ReadOperationR\n" + - "operations\"A\n" + - "\rReadOperation\x120\n" + - "\aaddress\x18\x01 \x01(\v2\x16.sink.v1.RecordAddressR\aaddress\"=\n" + - "\fReadResponse\x12-\n" + - "\aresults\x18\x01 \x03(\v2\x13.sink.v1.ReadResultR\aresults\"\xbd\x01\n" + - "\n" + - "ReadResult\x12'\n" + - "\x0foperation_index\x18\x01 \x01(\rR\x0eoperationIndex\x12+\n" + - "\x06status\x18\x02 \x01(\x0e2\x13.sink.v1.ReadStatusR\x06status\x12-\n" + - "\bdocument\x18\x03 \x01(\v2\x11.sink.v1.DocumentR\bdocument\x12*\n" + - "\afailure\x18\x05 \x01(\v2\x10.sink.v1.FailureR\afailure\"\xc1\x01\n" + - "\fWriteRequest\x12@\n" + - "\x0fcompletion_mode\x18\x01 \x01(\x0e2\x17.sink.v1.CompletionModeR\x0ecompletionMode\x127\n" + - "\n" + - "operations\x18\x02 \x03(\v2\x17.sink.v1.WriteOperationR\n" + - "operations\x126\n" + - "\flua_programs\x18\x03 \x03(\v2\x13.sink.v1.LuaProgramR\vluaPrograms\"\xd1\x01\n" + - "\x0eWriteOperation\x120\n" + - "\aaddress\x18\x01 \x01(\v2\x16.sink.v1.RecordAddressR\aaddress\x12)\n" + - "\x03put\x18\x02 \x01(\v2\x15.sink.v1.PutOperationH\x00R\x03put\x12/\n" + - "\x05merge\x18\x03 \x01(\v2\x17.sink.v1.MergeOperationH\x00R\x05merge\x12'\n" + - "\x0freturn_document\x18\x04 \x01(\bR\x0ereturnDocumentB\b\n" + - "\x06action\"e\n" + - "\fPutOperation\x12-\n" + - "\bdocument\x18\x01 \x01(\v2\x11.sink.v1.DocumentR\bdocument\x12&\n" + - "\x04mode\x18\x02 \x01(\x0e2\x12.sink.v1.WriteModeR\x04mode\"\x86\x01\n" + - "\x0eMergeOperation\x12>\n" + - "\x11incoming_document\x18\x01 \x01(\v2\x11.sink.v1.DocumentR\x10incomingDocument\x124\n" + - "\vlua_program\x18\x02 \x01(\v2\x13.sink.v1.LuaProgramR\n" + - "luaProgram\"<\n" + - "\n" + - "LuaProgram\x12\x16\n" + - "\x06source\x18\x01 \x01(\fR\x06source\x12\x16\n" + - "\x06sha256\x18\x02 \x01(\fR\x06sha256\"?\n" + - "\rWriteResponse\x12.\n" + - "\aresults\x18\x01 \x03(\v2\x14.sink.v1.WriteResultR\aresults\"\xbf\x01\n" + - "\vWriteResult\x12'\n" + - "\x0foperation_index\x18\x01 \x01(\rR\x0eoperationIndex\x12,\n" + - "\x06status\x18\x02 \x01(\x0e2\x14.sink.v1.WriteStatusR\x06status\x12*\n" + - "\afailure\x18\x04 \x01(\v2\x10.sink.v1.FailureR\afailure\x12-\n" + - "\bdocument\x18\x05 \x01(\v2\x11.sink.v1.DocumentR\bdocument\"\x8b\x01\n" + - "\rDeleteRequest\x12@\n" + - "\x0fcompletion_mode\x18\x01 \x01(\x0e2\x17.sink.v1.CompletionModeR\x0ecompletionMode\x128\n" + - "\n" + - "operations\x18\x02 \x03(\v2\x18.sink.v1.DeleteOperationR\n" + - "operations\"C\n" + - "\x0fDeleteOperation\x120\n" + - "\aaddress\x18\x01 \x01(\v2\x16.sink.v1.RecordAddressR\aaddress\"A\n" + - "\x0eDeleteResponse\x12/\n" + - "\aresults\x18\x01 \x03(\v2\x15.sink.v1.DeleteResultR\aresults\"\x92\x01\n" + - "\fDeleteResult\x12'\n" + - "\x0foperation_index\x18\x01 \x01(\rR\x0eoperationIndex\x12-\n" + - "\x06status\x18\x02 \x01(\x0e2\x15.sink.v1.DeleteStatusR\x06status\x12*\n" + - "\afailure\x18\x03 \x01(\v2\x10.sink.v1.FailureR\afailure\"k\n" + - "\aFailure\x12(\n" + - "\x04code\x18\x01 \x01(\x0e2\x14.sink.v1.FailureCodeR\x04code\x12\x18\n" + - "\amessage\x18\x02 \x01(\tR\amessage\x12\x1c\n" + - "\tretryable\x18\x03 \x01(\bR\tretryable\"\xc5\x01\n" + - "\aCommand\x12\x10\n" + - "\x03uri\x18\x01 \x01(\tR\x03uri\x12\x16\n" + - "\x06method\x18\x02 \x01(\tR\x06method\x12\x12\n" + - "\x04path\x18\x03 \x01(\tR\x04path\x12\x14\n" + - "\x05query\x18\x04 \x01(\tR\x05query\x12)\n" + - "\aheaders\x18\x05 \x03(\v2\x0f.sink.v1.HeaderR\aheaders\x12!\n" + - "\fcontent_type\x18\x06 \x01(\tR\vcontentType\x12\x18\n" + - "\apayload\x18\a \x01(\fR\apayload\"4\n" + - "\x06Header\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + - "\x06values\x18\x02 \x03(\tR\x06values\"<\n" + - "\x0eExecuteRequest\x12*\n" + - "\acommand\x18\x01 \x01(\v2\x10.sink.v1.CommandR\acommand\"\xb4\x01\n" + - "\x0fExecuteResponse\x12!\n" + - "\fcontent_type\x18\x01 \x01(\tR\vcontentType\x12\x18\n" + - "\apayload\x18\x02 \x01(\fR\apayload\x12\x18\n" + - "\asuccess\x18\x03 \x01(\bR\asuccess\x12\x1f\n" + - "\vstatus_code\x18\x04 \x01(\rR\n" + - "statusCode\x12)\n" + - "\aheaders\x18\x05 \x03(\v2\x0f.sink.v1.HeaderR\aheaders\"\xc8\x01\n" + - "\fQueryRequest\x12*\n" + - "\acommand\x18\x01 \x01(\v2\x10.sink.v1.CommandR\acommand\x12\x12\n" + - "\x04page\x18\x02 \x01(\rR\x04page\x12\x1b\n" + - "\tpage_size\x18\x03 \x01(\rR\bpageSize\x12&\n" + - "\x04sort\x18\x04 \x03(\v2\x12.sink.v1.SortFieldR\x04sort\x123\n" + - "\n" + - "projection\x18\x05 \x01(\v2\x13.sink.v1.ProjectionR\n" + - "projection\"A\n" + - "\tSortField\x12\x14\n" + - "\x05field\x18\x01 \x01(\tR\x05field\x12\x1e\n" + - "\n" + - "descending\x18\x02 \x01(\bR\n" + - "descending\">\n" + - "\n" + - "Projection\x12\x16\n" + - "\x06fields\x18\x01 \x03(\tR\x06fields\x12\x18\n" + - "\aexclude\x18\x02 \x01(\bR\aexclude\"w\n" + - "\rQueryResponse\x12/\n" + - "\tdocuments\x18\x01 \x03(\v2\x11.sink.v1.DocumentR\tdocuments\x12\x19\n" + - "\bhas_more\x18\x02 \x01(\bR\ahasMore\x12\x1a\n" + - "\bcomplete\x18\x03 \x01(\bR\bcomplete\":\n" + - "\fCountRequest\x12*\n" + - "\acommand\x18\x01 \x01(\v2\x10.sink.v1.CommandR\acommand\"C\n" + - "\rCountResponse\x12\x14\n" + - "\x05count\x18\x01 \x01(\x04R\x05count\x12\x1c\n" + - "\testimated\x18\x02 \x01(\bR\testimated\"\xa5\x01\n" + - "\vScanRequest\x12*\n" + - "\acommand\x18\x01 \x01(\v2\x10.sink.v1.CommandR\acommand\x12\x1d\n" + - "\n" + - "batch_size\x18\x02 \x01(\rR\tbatchSize\x12\x16\n" + - "\x06cursor\x18\x03 \x01(\fR\x06cursor\x123\n" + - "\n" + - "projection\x18\x04 \x01(\v2\x13.sink.v1.ProjectionR\n" + - "projection\"|\n" + - "\fScanResponse\x12/\n" + - "\tdocuments\x18\x01 \x03(\v2\x11.sink.v1.DocumentR\tdocuments\x12\x1f\n" + - "\vnext_cursor\x18\x02 \x01(\fR\n" + - "nextCursor\x12\x1a\n" + - "\bcomplete\x18\x03 \x01(\bR\bcomplete*m\n" + - "\x10DocumentEncoding\x12!\n" + - "\x1dDOCUMENT_ENCODING_UNSPECIFIED\x10\x00\x12\x1a\n" + - "\x16DOCUMENT_ENCODING_JSON\x10\x01\x12\x1a\n" + - "\x16DOCUMENT_ENCODING_BSON\x10\x02*\xac\x01\n" + - "\x0eCompletionMode\x12\x1f\n" + - "\x1bCOMPLETION_MODE_UNSPECIFIED\x10\x00\x12&\n" + - "\"COMPLETION_MODE_WAIT_UNTIL_APPLIED\x10\x01\x12)\n" + - "%COMPLETION_MODE_RETURN_AFTER_ACCEPTED\x10\x02\x12&\n" + - "\"COMPLETION_MODE_WAIT_UNTIL_VISIBLE\x10\x03*s\n" + - "\n" + - "ReadStatus\x12\x1b\n" + - "\x17READ_STATUS_UNSPECIFIED\x10\x00\x12\x15\n" + - "\x11READ_STATUS_FOUND\x10\x01\x12\x19\n" + - "\x15READ_STATUS_NOT_FOUND\x10\x02\x12\x16\n" + - "\x12READ_STATUS_FAILED\x10\x03*m\n" + - "\tWriteMode\x12\x1a\n" + - "\x16WRITE_MODE_UNSPECIFIED\x10\x00\x12\x15\n" + - "\x11WRITE_MODE_CREATE\x10\x01\x12\x16\n" + - "\x12WRITE_MODE_REPLACE\x10\x02\x12\x15\n" + - "\x11WRITE_MODE_UPSERT\x10\x03*\x9f\x01\n" + - "\vWriteStatus\x12\x1c\n" + - "\x18WRITE_STATUS_UNSPECIFIED\x10\x00\x12\x19\n" + - "\x15WRITE_STATUS_ACCEPTED\x10\x01\x12\x18\n" + - "\x14WRITE_STATUS_APPLIED\x10\x02\x12$\n" + - " WRITE_STATUS_PRECONDITION_FAILED\x10\x03\x12\x17\n" + - "\x13WRITE_STATUS_FAILED\x10\x04*~\n" + - "\fDeleteStatus\x12\x1d\n" + - "\x19DELETE_STATUS_UNSPECIFIED\x10\x00\x12\x1a\n" + - "\x16DELETE_STATUS_ACCEPTED\x10\x01\x12\x19\n" + - "\x15DELETE_STATUS_APPLIED\x10\x02\x12\x18\n" + - "\x14DELETE_STATUS_FAILED\x10\x03*\xad\x02\n" + - "\vFailureCode\x12\x1c\n" + - "\x18FAILURE_CODE_UNSPECIFIED\x10\x00\x12!\n" + - "\x1dFAILURE_CODE_INVALID_ARGUMENT\x10\x01\x12$\n" + - " FAILURE_CODE_PRECONDITION_FAILED\x10\x02\x12\x1a\n" + - "\x16FAILURE_CODE_NOT_FOUND\x10\x03\x12\x19\n" + - "\x15FAILURE_CODE_CONFLICT\x10\x04\x12#\n" + - "\x1fFAILURE_CODE_RESOURCE_EXHAUSTED\x10\x05\x12\x1c\n" + - "\x18FAILURE_CODE_UNAVAILABLE\x10\x06\x12\"\n" + - "\x1eFAILURE_CODE_DEADLINE_EXCEEDED\x10\a\x12\x19\n" + - "\x15FAILURE_CODE_INTERNAL\x10\b2\x99\x03\n" + - "\x04Sink\x125\n" + - "\x04Read\x12\x14.sink.v1.ReadRequest\x1a\x15.sink.v1.ReadResponse0\x01\x128\n" + - "\x05Write\x12\x15.sink.v1.WriteRequest\x1a\x16.sink.v1.WriteResponse0\x01\x129\n" + - "\x06Delete\x12\x16.sink.v1.DeleteRequest\x1a\x17.sink.v1.DeleteResponse\x12<\n" + - "\aExecute\x12\x17.sink.v1.ExecuteRequest\x1a\x18.sink.v1.ExecuteResponse\x128\n" + - "\x05Query\x12\x15.sink.v1.QueryRequest\x1a\x16.sink.v1.QueryResponse0\x01\x126\n" + - "\x05Count\x12\x15.sink.v1.CountRequest\x1a\x16.sink.v1.CountResponse\x125\n" + - "\x04Scan\x12\x14.sink.v1.ScanRequest\x1a\x15.sink.v1.ScanResponse0\x01B3Z1github.com/batchstream/sink-go/api/sink/v1;sinkv1b\x06proto3" - -var ( - file_sink_sink_proto_rawDescOnce sync.Once - file_sink_sink_proto_rawDescData []byte -) - -func file_sink_sink_proto_rawDescGZIP() []byte { - file_sink_sink_proto_rawDescOnce.Do(func() { - file_sink_sink_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_sink_sink_proto_rawDesc), len(file_sink_sink_proto_rawDesc))) - }) - return file_sink_sink_proto_rawDescData -} - -var file_sink_sink_proto_enumTypes = make([]protoimpl.EnumInfo, 7) -var file_sink_sink_proto_msgTypes = make([]protoimpl.MessageInfo, 30) -var file_sink_sink_proto_goTypes = []any{ - (DocumentEncoding)(0), // 0: sink.v1.DocumentEncoding - (CompletionMode)(0), // 1: sink.v1.CompletionMode - (ReadStatus)(0), // 2: sink.v1.ReadStatus - (WriteMode)(0), // 3: sink.v1.WriteMode - (WriteStatus)(0), // 4: sink.v1.WriteStatus - (DeleteStatus)(0), // 5: sink.v1.DeleteStatus - (FailureCode)(0), // 6: sink.v1.FailureCode - (*RecordAddress)(nil), // 7: sink.v1.RecordAddress - (*Document)(nil), // 8: sink.v1.Document - (*ReadRequest)(nil), // 9: sink.v1.ReadRequest - (*ReadOperation)(nil), // 10: sink.v1.ReadOperation - (*ReadResponse)(nil), // 11: sink.v1.ReadResponse - (*ReadResult)(nil), // 12: sink.v1.ReadResult - (*WriteRequest)(nil), // 13: sink.v1.WriteRequest - (*WriteOperation)(nil), // 14: sink.v1.WriteOperation - (*PutOperation)(nil), // 15: sink.v1.PutOperation - (*MergeOperation)(nil), // 16: sink.v1.MergeOperation - (*LuaProgram)(nil), // 17: sink.v1.LuaProgram - (*WriteResponse)(nil), // 18: sink.v1.WriteResponse - (*WriteResult)(nil), // 19: sink.v1.WriteResult - (*DeleteRequest)(nil), // 20: sink.v1.DeleteRequest - (*DeleteOperation)(nil), // 21: sink.v1.DeleteOperation - (*DeleteResponse)(nil), // 22: sink.v1.DeleteResponse - (*DeleteResult)(nil), // 23: sink.v1.DeleteResult - (*Failure)(nil), // 24: sink.v1.Failure - (*Command)(nil), // 25: sink.v1.Command - (*Header)(nil), // 26: sink.v1.Header - (*ExecuteRequest)(nil), // 27: sink.v1.ExecuteRequest - (*ExecuteResponse)(nil), // 28: sink.v1.ExecuteResponse - (*QueryRequest)(nil), // 29: sink.v1.QueryRequest - (*SortField)(nil), // 30: sink.v1.SortField - (*Projection)(nil), // 31: sink.v1.Projection - (*QueryResponse)(nil), // 32: sink.v1.QueryResponse - (*CountRequest)(nil), // 33: sink.v1.CountRequest - (*CountResponse)(nil), // 34: sink.v1.CountResponse - (*ScanRequest)(nil), // 35: sink.v1.ScanRequest - (*ScanResponse)(nil), // 36: sink.v1.ScanResponse -} -var file_sink_sink_proto_depIdxs = []int32{ - 0, // 0: sink.v1.Document.encoding:type_name -> sink.v1.DocumentEncoding - 10, // 1: sink.v1.ReadRequest.operations:type_name -> sink.v1.ReadOperation - 7, // 2: sink.v1.ReadOperation.address:type_name -> sink.v1.RecordAddress - 12, // 3: sink.v1.ReadResponse.results:type_name -> sink.v1.ReadResult - 2, // 4: sink.v1.ReadResult.status:type_name -> sink.v1.ReadStatus - 8, // 5: sink.v1.ReadResult.document:type_name -> sink.v1.Document - 24, // 6: sink.v1.ReadResult.failure:type_name -> sink.v1.Failure - 1, // 7: sink.v1.WriteRequest.completion_mode:type_name -> sink.v1.CompletionMode - 14, // 8: sink.v1.WriteRequest.operations:type_name -> sink.v1.WriteOperation - 17, // 9: sink.v1.WriteRequest.lua_programs:type_name -> sink.v1.LuaProgram - 7, // 10: sink.v1.WriteOperation.address:type_name -> sink.v1.RecordAddress - 15, // 11: sink.v1.WriteOperation.put:type_name -> sink.v1.PutOperation - 16, // 12: sink.v1.WriteOperation.merge:type_name -> sink.v1.MergeOperation - 8, // 13: sink.v1.PutOperation.document:type_name -> sink.v1.Document - 3, // 14: sink.v1.PutOperation.mode:type_name -> sink.v1.WriteMode - 8, // 15: sink.v1.MergeOperation.incoming_document:type_name -> sink.v1.Document - 17, // 16: sink.v1.MergeOperation.lua_program:type_name -> sink.v1.LuaProgram - 19, // 17: sink.v1.WriteResponse.results:type_name -> sink.v1.WriteResult - 4, // 18: sink.v1.WriteResult.status:type_name -> sink.v1.WriteStatus - 24, // 19: sink.v1.WriteResult.failure:type_name -> sink.v1.Failure - 8, // 20: sink.v1.WriteResult.document:type_name -> sink.v1.Document - 1, // 21: sink.v1.DeleteRequest.completion_mode:type_name -> sink.v1.CompletionMode - 21, // 22: sink.v1.DeleteRequest.operations:type_name -> sink.v1.DeleteOperation - 7, // 23: sink.v1.DeleteOperation.address:type_name -> sink.v1.RecordAddress - 23, // 24: sink.v1.DeleteResponse.results:type_name -> sink.v1.DeleteResult - 5, // 25: sink.v1.DeleteResult.status:type_name -> sink.v1.DeleteStatus - 24, // 26: sink.v1.DeleteResult.failure:type_name -> sink.v1.Failure - 6, // 27: sink.v1.Failure.code:type_name -> sink.v1.FailureCode - 26, // 28: sink.v1.Command.headers:type_name -> sink.v1.Header - 25, // 29: sink.v1.ExecuteRequest.command:type_name -> sink.v1.Command - 26, // 30: sink.v1.ExecuteResponse.headers:type_name -> sink.v1.Header - 25, // 31: sink.v1.QueryRequest.command:type_name -> sink.v1.Command - 30, // 32: sink.v1.QueryRequest.sort:type_name -> sink.v1.SortField - 31, // 33: sink.v1.QueryRequest.projection:type_name -> sink.v1.Projection - 8, // 34: sink.v1.QueryResponse.documents:type_name -> sink.v1.Document - 25, // 35: sink.v1.CountRequest.command:type_name -> sink.v1.Command - 25, // 36: sink.v1.ScanRequest.command:type_name -> sink.v1.Command - 31, // 37: sink.v1.ScanRequest.projection:type_name -> sink.v1.Projection - 8, // 38: sink.v1.ScanResponse.documents:type_name -> sink.v1.Document - 9, // 39: sink.v1.Sink.Read:input_type -> sink.v1.ReadRequest - 13, // 40: sink.v1.Sink.Write:input_type -> sink.v1.WriteRequest - 20, // 41: sink.v1.Sink.Delete:input_type -> sink.v1.DeleteRequest - 27, // 42: sink.v1.Sink.Execute:input_type -> sink.v1.ExecuteRequest - 29, // 43: sink.v1.Sink.Query:input_type -> sink.v1.QueryRequest - 33, // 44: sink.v1.Sink.Count:input_type -> sink.v1.CountRequest - 35, // 45: sink.v1.Sink.Scan:input_type -> sink.v1.ScanRequest - 11, // 46: sink.v1.Sink.Read:output_type -> sink.v1.ReadResponse - 18, // 47: sink.v1.Sink.Write:output_type -> sink.v1.WriteResponse - 22, // 48: sink.v1.Sink.Delete:output_type -> sink.v1.DeleteResponse - 28, // 49: sink.v1.Sink.Execute:output_type -> sink.v1.ExecuteResponse - 32, // 50: sink.v1.Sink.Query:output_type -> sink.v1.QueryResponse - 34, // 51: sink.v1.Sink.Count:output_type -> sink.v1.CountResponse - 36, // 52: sink.v1.Sink.Scan:output_type -> sink.v1.ScanResponse - 46, // [46:53] is the sub-list for method output_type - 39, // [39:46] is the sub-list for method input_type - 39, // [39:39] is the sub-list for extension type_name - 39, // [39:39] is the sub-list for extension extendee - 0, // [0:39] is the sub-list for field type_name -} - -func init() { file_sink_sink_proto_init() } -func file_sink_sink_proto_init() { - if File_sink_sink_proto != nil { - return - } - file_sink_sink_proto_msgTypes[7].OneofWrappers = []any{ - (*WriteOperation_Put)(nil), - (*WriteOperation_Merge)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_sink_sink_proto_rawDesc), len(file_sink_sink_proto_rawDesc)), - NumEnums: 7, - NumMessages: 30, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_sink_sink_proto_goTypes, - DependencyIndexes: file_sink_sink_proto_depIdxs, - EnumInfos: file_sink_sink_proto_enumTypes, - MessageInfos: file_sink_sink_proto_msgTypes, - }.Build() - File_sink_sink_proto = out.File - file_sink_sink_proto_goTypes = nil - file_sink_sink_proto_depIdxs = nil -} diff --git a/api/sink/v1/sink_grpc.pb.go b/api/sink/v1/sink_grpc.pb.go deleted file mode 100644 index 47303f4..0000000 --- a/api/sink/v1/sink_grpc.pb.go +++ /dev/null @@ -1,373 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc v6.33.4 -// source: sink/sink.proto - -package sinkv1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - Sink_Read_FullMethodName = "/sink.v1.Sink/Read" - Sink_Write_FullMethodName = "/sink.v1.Sink/Write" - Sink_Delete_FullMethodName = "/sink.v1.Sink/Delete" - Sink_Execute_FullMethodName = "/sink.v1.Sink/Execute" - Sink_Query_FullMethodName = "/sink.v1.Sink/Query" - Sink_Count_FullMethodName = "/sink.v1.Sink/Count" - Sink_Scan_FullMethodName = "/sink.v1.Sink/Scan" -) - -// SinkClient is the client API for Sink service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Sink provides database-independent record reads and mutations. -// -// Record requests are batch-native. Atomicity is guaranteed per record, never -// for the whole request. Native queries use Execute, Query, Count or paged Scan. -type SinkClient interface { - Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ReadResponse], error) - Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WriteResponse], error) - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) - Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error) - Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[QueryResponse], error) - Count(ctx context.Context, in *CountRequest, opts ...grpc.CallOption) (*CountResponse, error) - Scan(ctx context.Context, in *ScanRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ScanResponse], error) -} - -type sinkClient struct { - cc grpc.ClientConnInterface -} - -func NewSinkClient(cc grpc.ClientConnInterface) SinkClient { - client := &sinkClient{cc} - return client -} - -func (c *sinkClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ReadResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &Sink_ServiceDesc.Streams[0], Sink_Read_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &grpc.GenericClientStream[ReadRequest, ReadResponse]{ClientStream: 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 -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Sink_ReadClient = grpc.ServerStreamingClient[ReadResponse] - -func (c *sinkClient) Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WriteResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &Sink_ServiceDesc.Streams[1], Sink_Write_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &grpc.GenericClientStream[WriteRequest, WriteResponse]{ClientStream: 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 -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Sink_WriteClient = grpc.ServerStreamingClient[WriteResponse] - -func (c *sinkClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(DeleteResponse) - err := c.cc.Invoke(ctx, Sink_Delete_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sinkClient) Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ExecuteResponse) - err := c.cc.Invoke(ctx, Sink_Execute_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sinkClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[QueryResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &Sink_ServiceDesc.Streams[2], Sink_Query_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &grpc.GenericClientStream[QueryRequest, QueryResponse]{ClientStream: 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 -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Sink_QueryClient = grpc.ServerStreamingClient[QueryResponse] - -func (c *sinkClient) Count(ctx context.Context, in *CountRequest, opts ...grpc.CallOption) (*CountResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CountResponse) - err := c.cc.Invoke(ctx, Sink_Count_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sinkClient) Scan(ctx context.Context, in *ScanRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ScanResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &Sink_ServiceDesc.Streams[3], Sink_Scan_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &grpc.GenericClientStream[ScanRequest, ScanResponse]{ClientStream: 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 -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Sink_ScanClient = grpc.ServerStreamingClient[ScanResponse] - -// SinkServer is the server API for Sink service. -// All implementations must embed UnimplementedSinkServer -// for forward compatibility. -// -// Sink provides database-independent record reads and mutations. -// -// Record requests are batch-native. Atomicity is guaranteed per record, never -// for the whole request. Native queries use Execute, Query, Count or paged Scan. -type SinkServer interface { - Read(*ReadRequest, grpc.ServerStreamingServer[ReadResponse]) error - Write(*WriteRequest, grpc.ServerStreamingServer[WriteResponse]) error - Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error) - Query(*QueryRequest, grpc.ServerStreamingServer[QueryResponse]) error - Count(context.Context, *CountRequest) (*CountResponse, error) - Scan(*ScanRequest, grpc.ServerStreamingServer[ScanResponse]) error - mustEmbedUnimplementedSinkServer() -} - -// UnimplementedSinkServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedSinkServer struct{} - -func (UnimplementedSinkServer) Read(*ReadRequest, grpc.ServerStreamingServer[ReadResponse]) error { - return status.Errorf(codes.Unimplemented, "method Read not implemented") -} -func (UnimplementedSinkServer) Write(*WriteRequest, grpc.ServerStreamingServer[WriteResponse]) error { - return status.Errorf(codes.Unimplemented, "method Write not implemented") -} -func (UnimplementedSinkServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") -} -func (UnimplementedSinkServer) Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Execute not implemented") -} -func (UnimplementedSinkServer) Query(*QueryRequest, grpc.ServerStreamingServer[QueryResponse]) error { - return status.Errorf(codes.Unimplemented, "method Query not implemented") -} -func (UnimplementedSinkServer) Count(context.Context, *CountRequest) (*CountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Count not implemented") -} -func (UnimplementedSinkServer) Scan(*ScanRequest, grpc.ServerStreamingServer[ScanResponse]) error { - return status.Errorf(codes.Unimplemented, "method Scan not implemented") -} -func (UnimplementedSinkServer) mustEmbedUnimplementedSinkServer() {} -func (UnimplementedSinkServer) testEmbeddedByValue() {} - -// UnsafeSinkServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to SinkServer will -// result in compilation errors. -type UnsafeSinkServer interface { - mustEmbedUnimplementedSinkServer() -} - -func RegisterSinkServer(s grpc.ServiceRegistrar, srv SinkServer) { - // If the following call pancis, it indicates UnimplementedSinkServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&Sink_ServiceDesc, srv) -} - -func _Sink_Read_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ReadRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(SinkServer).Read(m, &grpc.GenericServerStream[ReadRequest, ReadResponse]{ServerStream: stream}) -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Sink_ReadServer = grpc.ServerStreamingServer[ReadResponse] - -func _Sink_Write_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(WriteRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(SinkServer).Write(m, &grpc.GenericServerStream[WriteRequest, WriteResponse]{ServerStream: stream}) -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Sink_WriteServer = grpc.ServerStreamingServer[WriteResponse] - -func _Sink_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SinkServer).Delete(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Sink_Delete_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SinkServer).Delete(ctx, req.(*DeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Sink_Execute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ExecuteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SinkServer).Execute(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Sink_Execute_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SinkServer).Execute(ctx, req.(*ExecuteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Sink_Query_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(QueryRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(SinkServer).Query(m, &grpc.GenericServerStream[QueryRequest, QueryResponse]{ServerStream: stream}) -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Sink_QueryServer = grpc.ServerStreamingServer[QueryResponse] - -func _Sink_Count_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SinkServer).Count(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Sink_Count_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SinkServer).Count(ctx, req.(*CountRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Sink_Scan_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ScanRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(SinkServer).Scan(m, &grpc.GenericServerStream[ScanRequest, ScanResponse]{ServerStream: stream}) -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Sink_ScanServer = grpc.ServerStreamingServer[ScanResponse] - -// Sink_ServiceDesc is the grpc.ServiceDesc for Sink service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Sink_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "sink.v1.Sink", - HandlerType: (*SinkServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Delete", - Handler: _Sink_Delete_Handler, - }, - { - MethodName: "Execute", - Handler: _Sink_Execute_Handler, - }, - { - MethodName: "Count", - Handler: _Sink_Count_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Read", - Handler: _Sink_Read_Handler, - ServerStreams: true, - }, - { - StreamName: "Write", - Handler: _Sink_Write_Handler, - ServerStreams: true, - }, - { - StreamName: "Query", - Handler: _Sink_Query_Handler, - ServerStreams: true, - }, - { - StreamName: "Scan", - Handler: _Sink_Scan_Handler, - ServerStreams: true, - }, - }, - Metadata: "sink/sink.proto", -} diff --git a/api/sink/v1/sink_vtproto.pb.go b/api/sink/v1/sink_vtproto.pb.go deleted file mode 100644 index ee12926..0000000 --- a/api/sink/v1/sink_vtproto.pb.go +++ /dev/null @@ -1,6062 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.1-0.20240319094008-0393e58bdf10 -// source: sink/sink.proto - -package sinkv1 - -import ( - fmt "fmt" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *RecordAddress) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RecordAddress) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *RecordAddress) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Uri) > 0 { - i -= len(m.Uri) - copy(dAtA[i:], m.Uri) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Uri))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Document) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Document) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Document) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Payload) > 0 { - i -= len(m.Payload) - copy(dAtA[i:], m.Payload) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Payload))) - i-- - dAtA[i] = 0x12 - } - if m.Encoding != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Encoding)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ReadRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ReadRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ReadRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Operations) > 0 { - for iNdEx := len(m.Operations) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Operations[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ReadOperation) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ReadOperation) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ReadOperation) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Address != nil { - size, err := m.Address.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ReadResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ReadResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ReadResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Results) > 0 { - for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Results[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ReadResult) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ReadResult) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ReadResult) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Failure != nil { - size, err := m.Failure.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - if m.Document != nil { - size, err := m.Document.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.Status != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x10 - } - if m.OperationIndex != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.OperationIndex)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *WriteRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WriteRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WriteRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.LuaPrograms) > 0 { - for iNdEx := len(m.LuaPrograms) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.LuaPrograms[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Operations) > 0 { - for iNdEx := len(m.Operations) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Operations[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - } - if m.CompletionMode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.CompletionMode)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *WriteOperation) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WriteOperation) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WriteOperation) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if vtmsg, ok := m.Action.(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if m.ReturnDocument { - i-- - if m.ReturnDocument { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.Address != nil { - size, err := m.Address.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *WriteOperation_Put) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WriteOperation_Put) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Put != nil { - size, err := m.Put.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *WriteOperation_Merge) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WriteOperation_Merge) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Merge != nil { - size, err := m.Merge.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *PutOperation) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutOperation) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *PutOperation) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Mode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Mode)) - i-- - dAtA[i] = 0x10 - } - if m.Document != nil { - size, err := m.Document.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MergeOperation) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MergeOperation) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *MergeOperation) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.LuaProgram != nil { - size, err := m.LuaProgram.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.IncomingDocument != nil { - size, err := m.IncomingDocument.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LuaProgram) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LuaProgram) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *LuaProgram) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Sha256) > 0 { - i -= len(m.Sha256) - copy(dAtA[i:], m.Sha256) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Sha256))) - i-- - dAtA[i] = 0x12 - } - if len(m.Source) > 0 { - i -= len(m.Source) - copy(dAtA[i:], m.Source) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Source))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *WriteResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WriteResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WriteResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Results) > 0 { - for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Results[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *WriteResult) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WriteResult) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WriteResult) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Document != nil { - size, err := m.Document.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - if m.Failure != nil { - size, err := m.Failure.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - if m.Status != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x10 - } - if m.OperationIndex != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.OperationIndex)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *DeleteRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *DeleteRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Operations) > 0 { - for iNdEx := len(m.Operations) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Operations[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - } - if m.CompletionMode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.CompletionMode)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *DeleteOperation) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteOperation) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *DeleteOperation) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Address != nil { - size, err := m.Address.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *DeleteResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Results) > 0 { - for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Results[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *DeleteResult) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteResult) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *DeleteResult) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Failure != nil { - size, err := m.Failure.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.Status != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x10 - } - if m.OperationIndex != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.OperationIndex)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Failure) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Failure) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Failure) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Retryable { - i-- - if m.Retryable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Message) > 0 { - i -= len(m.Message) - copy(dAtA[i:], m.Message) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Message))) - i-- - dAtA[i] = 0x12 - } - if m.Code != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Code)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Command) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Command) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Command) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Payload) > 0 { - i -= len(m.Payload) - copy(dAtA[i:], m.Payload) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Payload))) - i-- - dAtA[i] = 0x3a - } - if len(m.ContentType) > 0 { - i -= len(m.ContentType) - copy(dAtA[i:], m.ContentType) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ContentType))) - i-- - dAtA[i] = 0x32 - } - if len(m.Headers) > 0 { - for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Headers[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Query) > 0 { - i -= len(m.Query) - copy(dAtA[i:], m.Query) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Query))) - i-- - dAtA[i] = 0x22 - } - if len(m.Path) > 0 { - i -= len(m.Path) - copy(dAtA[i:], m.Path) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Path))) - i-- - dAtA[i] = 0x1a - } - if len(m.Method) > 0 { - i -= len(m.Method) - copy(dAtA[i:], m.Method) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Method))) - i-- - dAtA[i] = 0x12 - } - if len(m.Uri) > 0 { - i -= len(m.Uri) - copy(dAtA[i:], m.Uri) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Uri))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Header) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Header) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Header) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Values) > 0 { - for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Values[iNdEx]) - copy(dAtA[i:], m.Values[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Values[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ExecuteRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExecuteRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ExecuteRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Command != nil { - size, err := m.Command.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ExecuteResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExecuteResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ExecuteResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Headers) > 0 { - for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Headers[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if m.StatusCode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.StatusCode)) - i-- - dAtA[i] = 0x20 - } - if m.Success { - i-- - if m.Success { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Payload) > 0 { - i -= len(m.Payload) - copy(dAtA[i:], m.Payload) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Payload))) - i-- - dAtA[i] = 0x12 - } - if len(m.ContentType) > 0 { - i -= len(m.ContentType) - copy(dAtA[i:], m.ContentType) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ContentType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *QueryRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Projection != nil { - size, err := m.Projection.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - if len(m.Sort) > 0 { - for iNdEx := len(m.Sort) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Sort[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if m.PageSize != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.PageSize)) - i-- - dAtA[i] = 0x18 - } - if m.Page != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Page)) - i-- - dAtA[i] = 0x10 - } - if m.Command != nil { - size, err := m.Command.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SortField) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SortField) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SortField) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Descending { - i-- - if m.Descending { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.Field) > 0 { - i -= len(m.Field) - copy(dAtA[i:], m.Field) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Field))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Projection) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Projection) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Projection) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Exclude { - i-- - if m.Exclude { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.Fields) > 0 { - for iNdEx := len(m.Fields) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Fields[iNdEx]) - copy(dAtA[i:], m.Fields[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Fields[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *QueryResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Complete { - i-- - if m.Complete { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.HasMore { - i-- - if m.HasMore { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.Documents) > 0 { - for iNdEx := len(m.Documents) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Documents[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *CountRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CountRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *CountRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Command != nil { - size, err := m.Command.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CountResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CountResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *CountResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Estimated { - i-- - if m.Estimated { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Count != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Count)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ScanRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ScanRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ScanRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Projection != nil { - size, err := m.Projection.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - if len(m.Cursor) > 0 { - i -= len(m.Cursor) - copy(dAtA[i:], m.Cursor) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Cursor))) - i-- - dAtA[i] = 0x1a - } - if m.BatchSize != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.BatchSize)) - i-- - dAtA[i] = 0x10 - } - if m.Command != nil { - size, err := m.Command.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ScanResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ScanResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ScanResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Complete { - i-- - if m.Complete { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.NextCursor) > 0 { - i -= len(m.NextCursor) - copy(dAtA[i:], m.NextCursor) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.NextCursor))) - i-- - dAtA[i] = 0x12 - } - if len(m.Documents) > 0 { - for iNdEx := len(m.Documents) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Documents[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *RecordAddress) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Uri) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Document) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Encoding != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Encoding)) - } - l = len(m.Payload) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *ReadRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Operations) > 0 { - for _, e := range m.Operations { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *ReadOperation) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Address != nil { - l = m.Address.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *ReadResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Results) > 0 { - for _, e := range m.Results { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *ReadResult) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OperationIndex != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.OperationIndex)) - } - if m.Status != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Status)) - } - if m.Document != nil { - l = m.Document.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Failure != nil { - l = m.Failure.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *WriteRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CompletionMode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.CompletionMode)) - } - if len(m.Operations) > 0 { - for _, e := range m.Operations { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if len(m.LuaPrograms) > 0 { - for _, e := range m.LuaPrograms { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *WriteOperation) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Address != nil { - l = m.Address.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if vtmsg, ok := m.Action.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - if m.ReturnDocument { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *WriteOperation_Put) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Put != nil { - l = m.Put.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 3 - } - return n -} -func (m *WriteOperation_Merge) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Merge != nil { - l = m.Merge.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 3 - } - return n -} -func (m *PutOperation) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Document != nil { - l = m.Document.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Mode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Mode)) - } - n += len(m.unknownFields) - return n -} - -func (m *MergeOperation) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.IncomingDocument != nil { - l = m.IncomingDocument.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.LuaProgram != nil { - l = m.LuaProgram.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *LuaProgram) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Source) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Sha256) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *WriteResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Results) > 0 { - for _, e := range m.Results { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *WriteResult) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OperationIndex != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.OperationIndex)) - } - if m.Status != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Status)) - } - if m.Failure != nil { - l = m.Failure.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Document != nil { - l = m.Document.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *DeleteRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CompletionMode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.CompletionMode)) - } - if len(m.Operations) > 0 { - for _, e := range m.Operations { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *DeleteOperation) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Address != nil { - l = m.Address.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *DeleteResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Results) > 0 { - for _, e := range m.Results { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *DeleteResult) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OperationIndex != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.OperationIndex)) - } - if m.Status != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Status)) - } - if m.Failure != nil { - l = m.Failure.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Failure) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Code != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Code)) - } - l = len(m.Message) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Retryable { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *Command) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Uri) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Method) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Path) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Query) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.Headers) > 0 { - for _, e := range m.Headers { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - l = len(m.ContentType) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Payload) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Header) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.Values) > 0 { - for _, s := range m.Values { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *ExecuteRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Command != nil { - l = m.Command.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *ExecuteResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ContentType) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Payload) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Success { - n += 2 - } - if m.StatusCode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.StatusCode)) - } - if len(m.Headers) > 0 { - for _, e := range m.Headers { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *QueryRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Command != nil { - l = m.Command.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Page != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Page)) - } - if m.PageSize != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.PageSize)) - } - if len(m.Sort) > 0 { - for _, e := range m.Sort { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.Projection != nil { - l = m.Projection.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *SortField) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Field) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Descending { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *Projection) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Fields) > 0 { - for _, s := range m.Fields { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.Exclude { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *QueryResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Documents) > 0 { - for _, e := range m.Documents { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.HasMore { - n += 2 - } - if m.Complete { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *CountRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Command != nil { - l = m.Command.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *CountResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Count != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Count)) - } - if m.Estimated { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *ScanRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Command != nil { - l = m.Command.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.BatchSize != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.BatchSize)) - } - l = len(m.Cursor) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Projection != nil { - l = m.Projection.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *ScanResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Documents) > 0 { - for _, e := range m.Documents { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - l = len(m.NextCursor) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Complete { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *RecordAddress) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: RecordAddress: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RecordAddress: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Uri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Document) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: Document: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Document: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Encoding", wireType) - } - m.Encoding = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Encoding |= DocumentEncoding(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ReadRequest) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: ReadRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ReadRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Operations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &ReadOperation{} - m.Operations = append(m.Operations, item) - if err := m.Operations[len(m.Operations)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ReadOperation) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: ReadOperation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ReadOperation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Address == nil { - m.Address = &RecordAddress{} - } - if err := m.Address.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ReadResponse) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: ReadResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ReadResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &ReadResult{} - m.Results = append(m.Results, item) - if err := m.Results[len(m.Results)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ReadResult) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: ReadResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ReadResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OperationIndex", wireType) - } - m.OperationIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.OperationIndex |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= ReadStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Document", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Document == nil { - m.Document = &Document{} - } - if err := m.Document.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Failure", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Failure == nil { - m.Failure = &Failure{} - } - if err := m.Failure.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WriteRequest) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: WriteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WriteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CompletionMode", wireType) - } - m.CompletionMode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CompletionMode |= CompletionMode(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Operations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &WriteOperation{} - m.Operations = append(m.Operations, item) - if err := m.Operations[len(m.Operations)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LuaPrograms", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &LuaProgram{} - m.LuaPrograms = append(m.LuaPrograms, item) - if err := m.LuaPrograms[len(m.LuaPrograms)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WriteOperation) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: WriteOperation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WriteOperation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Address == nil { - m.Address = &RecordAddress{} - } - if err := m.Address.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Put", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if oneof, ok := m.Action.(*WriteOperation_Put); ok { - if err := oneof.Put.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - v := &PutOperation{} - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Action = &WriteOperation_Put{Put: v} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Merge", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if oneof, ok := m.Action.(*WriteOperation_Merge); ok { - if err := oneof.Merge.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - v := &MergeOperation{} - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Action = &WriteOperation_Merge{Merge: v} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReturnDocument", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ReturnDocument = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutOperation) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: PutOperation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutOperation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Document", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Document == nil { - m.Document = &Document{} - } - if err := m.Document.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) - } - m.Mode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Mode |= WriteMode(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MergeOperation) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: MergeOperation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MergeOperation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IncomingDocument", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.IncomingDocument == nil { - m.IncomingDocument = &Document{} - } - if err := m.IncomingDocument.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LuaProgram", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LuaProgram == nil { - m.LuaProgram = &LuaProgram{} - } - if err := m.LuaProgram.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LuaProgram) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: LuaProgram: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LuaProgram: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Source = append(m.Source[:0], dAtA[iNdEx:postIndex]...) - if m.Source == nil { - m.Source = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sha256", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sha256 = append(m.Sha256[:0], dAtA[iNdEx:postIndex]...) - if m.Sha256 == nil { - m.Sha256 = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WriteResponse) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: WriteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WriteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &WriteResult{} - m.Results = append(m.Results, item) - if err := m.Results[len(m.Results)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WriteResult) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: WriteResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WriteResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OperationIndex", wireType) - } - m.OperationIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.OperationIndex |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= WriteStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Failure", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Failure == nil { - m.Failure = &Failure{} - } - if err := m.Failure.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Document", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Document == nil { - m.Document = &Document{} - } - if err := m.Document.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRequest) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: DeleteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CompletionMode", wireType) - } - m.CompletionMode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CompletionMode |= CompletionMode(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Operations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &DeleteOperation{} - m.Operations = append(m.Operations, item) - if err := m.Operations[len(m.Operations)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteOperation) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: DeleteOperation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteOperation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Address == nil { - m.Address = &RecordAddress{} - } - if err := m.Address.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteResponse) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: DeleteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &DeleteResult{} - m.Results = append(m.Results, item) - if err := m.Results[len(m.Results)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteResult) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: DeleteResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OperationIndex", wireType) - } - m.OperationIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.OperationIndex |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= DeleteStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Failure", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Failure == nil { - m.Failure = &Failure{} - } - if err := m.Failure.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Failure) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: Failure: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Failure: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) - } - m.Code = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Code |= FailureCode(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Message = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Retryable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Retryable = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Command) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: Command: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Command: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Uri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Method = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Path = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Query = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - 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 protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &Header{} - m.Headers = append(m.Headers, item) - if err := m.Headers[len(m.Headers)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContentType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContentType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Header) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: Header: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Header: 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 protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - 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 Values", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Values = append(m.Values, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExecuteRequest) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: ExecuteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExecuteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Command", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Command == nil { - m.Command = &Command{} - } - if err := m.Command.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExecuteResponse) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: ExecuteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExecuteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContentType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContentType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Success = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusCode", wireType) - } - m.StatusCode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StatusCode |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - 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 protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &Header{} - m.Headers = append(m.Headers, item) - if err := m.Headers[len(m.Headers)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRequest) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: QueryRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Command", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Command == nil { - m.Command = &Command{} - } - if err := m.Command.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Page", wireType) - } - m.Page = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Page |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PageSize", wireType) - } - m.PageSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PageSize |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sort", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &SortField{} - m.Sort = append(m.Sort, item) - if err := m.Sort[len(m.Sort)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Projection", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Projection == nil { - m.Projection = &Projection{} - } - if err := m.Projection.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SortField) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: SortField: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SortField: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Field", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Field = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Descending", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Descending = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Projection) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: Projection: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Projection: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fields", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - 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 protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Fields = append(m.Fields, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exclude", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Exclude = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryResponse) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: QueryResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Documents", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &Document{} - m.Documents = append(m.Documents, item) - if err := m.Documents[len(m.Documents)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HasMore", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.HasMore = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Complete", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Complete = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CountRequest) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: CountRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CountRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Command", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Command == nil { - m.Command = &Command{} - } - if err := m.Command.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CountResponse) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: CountResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CountResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Estimated", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Estimated = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ScanRequest) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: ScanRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ScanRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Command", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Command == nil { - m.Command = &Command{} - } - if err := m.Command.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchSize", wireType) - } - m.BatchSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchSize |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cursor", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Cursor = append(m.Cursor[:0], dAtA[iNdEx:postIndex]...) - if m.Cursor == nil { - m.Cursor = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Projection", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Projection == nil { - m.Projection = &Projection{} - } - if err := m.Projection.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ScanResponse) UnmarshalVT(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 protohelpers.ErrIntOverflow - } - 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: ScanResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ScanResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Documents", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - item := &Document{} - m.Documents = append(m.Documents, item) - if err := m.Documents[len(m.Documents)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextCursor", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NextCursor = append(m.NextCursor[:0], dAtA[iNdEx:postIndex]...) - if m.NextCursor == nil { - m.NextCursor = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Complete", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Complete = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/balancing_test.go b/balancing_test.go index 2fc5f19..e9848eb 100644 --- a/balancing_test.go +++ b/balancing_test.go @@ -10,7 +10,7 @@ import ( "github.com/batchstream/sink-go/internal/testuri" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/resolver" diff --git a/client.go b/client.go index cb16a8f..3c3b345 100644 --- a/client.go +++ b/client.go @@ -12,7 +12,7 @@ import ( "strings" "time" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "google.golang.org/grpc" _ "google.golang.org/grpc/balancer/roundrobin" "google.golang.org/grpc/codes" diff --git a/client_test.go b/client_test.go index 6d3b4fb..9572b8f 100644 --- a/client_test.go +++ b/client_test.go @@ -14,10 +14,10 @@ import ( "time" "github.com/batchstream/sink-go/internal/testuri" - "github.com/batchstream/sink-go/uri" + "github.com/batchstream/sink-protocol/uri" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "go.mongodb.org/mongo-driver/v2/bson" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/contract_test.go b/contract_test.go index 4aba311..952b675 100644 --- a/contract_test.go +++ b/contract_test.go @@ -4,7 +4,7 @@ import ( "slices" "testing" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "google.golang.org/protobuf/reflect/protoreflect" ) diff --git a/dataset.go b/dataset.go index 3b5c62d..869ea00 100644 --- a/dataset.go +++ b/dataset.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "github.com/batchstream/sink-go/uri" + "github.com/batchstream/sink-protocol/uri" ) // DatasetOptions binds the stable routing, encoding, and optional merge diff --git a/dataset_native_test.go b/dataset_native_test.go index eb91442..507fbbd 100644 --- a/dataset_native_test.go +++ b/dataset_native_test.go @@ -11,7 +11,7 @@ import ( "github.com/batchstream/sink-go/internal/testuri" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "go.mongodb.org/mongo-driver/v2/bson" ) diff --git a/dataset_test.go b/dataset_test.go index d4def91..31d2cf7 100644 --- a/dataset_test.go +++ b/dataset_test.go @@ -13,7 +13,7 @@ import ( "github.com/batchstream/sink-go/internal/testuri" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "go.mongodb.org/mongo-driver/v2/bson" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/dns_balancing_integration_test.go b/dns_balancing_integration_test.go index c5d8a58..232069f 100644 --- a/dns_balancing_integration_test.go +++ b/dns_balancing_integration_test.go @@ -14,7 +14,7 @@ import ( "github.com/batchstream/sink-go/internal/testuri" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "golang.org/x/net/dns/dnsmessage" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" diff --git a/go.mod b/go.mod index 1787363..36a75e7 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/batchstream/sink-go go 1.27.0 require ( - github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 + github.com/batchstream/sink-protocol v0.1.0 go.mongodb.org/mongo-driver/v2 v2.8.2 golang.org/x/net v0.58.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa @@ -12,6 +12,7 @@ require ( ) require ( + github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.41.0 // indirect ) diff --git a/go.sum b/go.sum index 4b50af1..ec3843a 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/batchstream/sink-protocol v0.1.0 h1:tfm+yFrEmbv7CoucNVNeCe8vgr4Ymp3NMRQ2DCltaME= +github.com/batchstream/sink-protocol v0.1.0/go.mod h1:JSedc6w84ErTS/NbenzD/3V6/bL6LFWUepEZWRrI2JY= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/internal/testuri/uri.go b/internal/testuri/uri.go index bb0f284..0b063fd 100644 --- a/internal/testuri/uri.go +++ b/internal/testuri/uri.go @@ -1,7 +1,7 @@ // Package testuri constructs canonical URI fixtures for tests. package testuri -import "github.com/batchstream/sink-go/uri" +import "github.com/batchstream/sink-protocol/uri" func Resource(store string, segments []string) string { address, err := uri.New(store, segments) diff --git a/native.go b/native.go index 563c5b0..29df50d 100644 --- a/native.go +++ b/native.go @@ -13,8 +13,8 @@ import ( "sort" "strings" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" - "github.com/batchstream/sink-go/uri" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" + "github.com/batchstream/sink-protocol/uri" "go.mongodb.org/mongo-driver/v2/bson" "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" diff --git a/native_test.go b/native_test.go index a2a58c8..ad4d943 100644 --- a/native_test.go +++ b/native_test.go @@ -13,7 +13,7 @@ import ( "github.com/batchstream/sink-go/internal/testuri" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "go.mongodb.org/mongo-driver/v2/bson" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/proto/sink/sink.proto b/proto/sink/sink.proto deleted file mode 100644 index 5b799c8..0000000 --- a/proto/sink/sink.proto +++ /dev/null @@ -1,388 +0,0 @@ -syntax = "proto3"; - -package sink.v1; - -option go_package = "github.com/batchstream/sink-go/api/sink/v1;sinkv1"; - -// Sink provides database-independent record reads and mutations. -// -// Record requests are batch-native. Atomicity is guaranteed per record, never -// for the whole request. Native queries use Execute, Query, Count or paged Scan. -service Sink { - rpc Read(ReadRequest) returns (stream ReadResponse); - rpc Write(WriteRequest) returns (stream WriteResponse); - rpc Delete(DeleteRequest) returns (DeleteResponse); - rpc Execute(ExecuteRequest) returns (ExecuteResponse); - rpc Query(QueryRequest) returns (stream QueryResponse); - rpc Count(CountRequest) returns (CountResponse); - rpc Scan(ScanRequest) returns (stream ScanResponse); -} - -// RecordAddress is a canonical sink:/// URI. The core treats the -// path as opaque; each Store adapter owns its path grammar. The full canonical -// URI is the record identity for routing, batching, and durable delivery. -message RecordAddress { - string uri = 1; -} - -// Document contains one explicitly encoded user object. Callers select JSON -// for search storage and BSON for MongoDB storage. -message Document { - DocumentEncoding encoding = 1; - bytes payload = 2; -} - -enum DocumentEncoding { - DOCUMENT_ENCODING_UNSPECIFIED = 0; - DOCUMENT_ENCODING_JSON = 1; - DOCUMENT_ENCODING_BSON = 2; -} - -// CompletionMode defines the point at which a mutating RPC returns success. -enum CompletionMode { - COMPLETION_MODE_UNSPECIFIED = 0; - - // Wait until the storage adapter has applied each operation. - COMPLETION_MODE_WAIT_UNTIL_APPLIED = 1; - - // Return after a durable asynchronous queue has accepted each operation. - // Acceptance does not mean that the storage adapter has applied it. - COMPLETION_MODE_RETURN_AFTER_ACCEPTED = 2; - - // Wait until the storage adapter has applied each operation and made the - // result visible to subsequent reads. Search adapters use refresh=wait_for. - COMPLETION_MODE_WAIT_UNTIL_VISIBLE = 3; -} - -message ReadRequest { - repeated ReadOperation operations = 1; -} - -message ReadOperation { - RecordAddress address = 1; -} - -message ReadResponse { - // Each frame contains one result. Results may arrive out of order; correlate - // by operation_index. Successful EOF requires exactly one result per operation. - repeated ReadResult results = 1; -} - -message ReadResult { - uint32 operation_index = 1; - ReadStatus status = 2; - Document document = 3; - Failure failure = 5; -} - -enum ReadStatus { - READ_STATUS_UNSPECIFIED = 0; - READ_STATUS_FOUND = 1; - READ_STATUS_NOT_FOUND = 2; - READ_STATUS_FAILED = 3; -} - -message WriteRequest { - CompletionMode completion_mode = 1; - - // Operations for the same address are executed in request order. Operations - // for different addresses may execute concurrently. - repeated WriteOperation operations = 2; - - // Programs can be declared once and referenced by digest from multiple merge - // operations, avoiding repeated Lua source bytes in a synchronous batch. - repeated LuaProgram lua_programs = 3; -} - -message WriteOperation { - RecordAddress address = 1; - - oneof action { - PutOperation put = 2; - MergeOperation merge = 3; - } - - // Return the logical document submitted by this operation after its commit. - // Only synchronous completion modes support this. These operations do not - // share a folded commit with preceding or following operations. - bool return_document = 4; -} - -// PutOperation writes a complete user document without interpreting its fields. -message PutOperation { - Document document = 1; - WriteMode mode = 2; -} - -enum WriteMode { - WRITE_MODE_UNSPECIFIED = 0; - WRITE_MODE_CREATE = 1; - WRITE_MODE_REPLACE = 2; - WRITE_MODE_UPSERT = 3; -} - -// MergeOperation carries the original merge intent. In asynchronous mode Sink -// expands any program reference before queueing the operation so the worker can -// merge against the document version it reads at execution time. -message MergeOperation { - Document incoming_document = 1; - LuaProgram lua_program = 2; -} - -// LuaProgram is self-contained so merge rules can be versioned and deployed -// with the calling application instead of being registered in Sink. -message LuaProgram { - // Source may be omitted from a merge operation when the matching full program - // is present in WriteRequest.lua_programs. Workers always receive full source. - bytes source = 1; - - // Optional SHA-256 digest. Sink verifies it when present and always uses the - // computed digest as the compiled-program cache key. - bytes sha256 = 2; -} - -// Each frame contains one final result, identified by operation_index. -// A disconnected stream does not establish the outcome of missing operations. -message WriteResponse { - repeated WriteResult results = 1; -} - -message WriteResult { - uint32 operation_index = 1; - WriteStatus status = 2; - Failure failure = 4; - Document document = 5; -} - -enum WriteStatus { - WRITE_STATUS_UNSPECIFIED = 0; - - // The asynchronous queue accepted the operation durably. - WRITE_STATUS_ACCEPTED = 1; - - // The storage adapter applied the operation. - WRITE_STATUS_APPLIED = 2; - - // A CREATE, REPLACE, or adapter-level revision condition did not match. - WRITE_STATUS_PRECONDITION_FAILED = 3; - WRITE_STATUS_FAILED = 4; -} - -message DeleteRequest { - CompletionMode completion_mode = 1; - - // Deletes are hard deletes. Deleting an absent record is successful. - repeated DeleteOperation operations = 2; -} - -message DeleteOperation { - RecordAddress address = 1; -} - -message DeleteResponse { - repeated DeleteResult results = 1; -} - -message DeleteResult { - uint32 operation_index = 1; - DeleteStatus status = 2; - Failure failure = 3; -} - -enum DeleteStatus { - DELETE_STATUS_UNSPECIFIED = 0; - DELETE_STATUS_ACCEPTED = 1; - DELETE_STATUS_APPLIED = 2; - DELETE_STATUS_FAILED = 3; -} - -message Failure { - FailureCode code = 1; - string message = 2; - bool retryable = 3; -} - -enum FailureCode { - FAILURE_CODE_UNSPECIFIED = 0; - FAILURE_CODE_INVALID_ARGUMENT = 1; - FAILURE_CODE_PRECONDITION_FAILED = 2; - FAILURE_CODE_NOT_FOUND = 3; - FAILURE_CODE_CONFLICT = 4; - FAILURE_CODE_RESOURCE_EXHAUSTED = 5; - FAILURE_CODE_UNAVAILABLE = 6; - FAILURE_CODE_DEADLINE_EXCEEDED = 7; - FAILURE_CODE_INTERNAL = 8; -} - -// Command is shared by Execute, Query, Count and Scan. The canonical URI selects -// a configured Store; only its adapter interprets the remaining path. -// MongoDB uses sink://store/database[/collection] with an ordered BSON payload. -// HTTP search uses sink://store/index with a separate native operation path, -// such as /_search, method, query, headers and body. A Store root is -// spelled sink://store. Endpoints and authentication come from configuration. -message Command { - string uri = 1; - - // Native request method, such as GET or POST. Unused by MongoDB. - string method = 2; - - // Operation path relative to the URI resource, e.g. /_search or /_mapping. - // Unused by MongoDB; its operation is carried by the BSON command. - string path = 3; - - // URL-encoded query parameters without a leading '?'; repeated keys are valid. - string query = 4; - - // Authentication and transport-owned headers remain server-controlled. - // Set Content-Type using content_type, not headers. - repeated Header headers = 5; - - // Payload media type. Required when payload is nonempty. - string content_type = 6; - - // Original ordered command or request body, without a Sink-specific envelope. - bytes payload = 7; -} - -message Header { - string name = 1; - repeated string values = 2; -} - -// Execute performs one native interaction. It does not provide cross-RPC -// session affinity. Adapters reject commands requiring session affinity or a -// client-managed session; supported cursor queries use Scan instead. -// Each adapter validates its supported operations before forwarding. MongoDB -// protects revisions on supported writes; HTTP search rejects index lifecycle -// and alias management, including unknown administrative write endpoints. -// -// Permitted writes retain backend semantics subject to adapter safeguards. They -// do not run Lua merges, record batching or asynchronous completion. Neither -// Sink nor its SDK should automatically replay Execute after an unknown outcome. -message ExecuteRequest { - Command command = 1; -} - -// A complete native reply retains its original payload, including backend error -// replies. Such replies use gRPC OK with success=false; validation, transport -// and capacity failures use gRPC errors. HTTP replies preserve the status, -// repeated headers and entity bytes; redirects are returned without following. -message ExecuteResponse { - string content_type = 1; - bytes payload = 2; - - // Native command success, or HTTP 2xx. Callers must still inspect item-level - // failures in batch responses. Document commands also check native write and - // write-concern errors. - bool success = 3; - - // Native transport status when available; zero means no such status exists. - uint32 status_code = 4; - repeated Header headers = 5; -} - -// Query returns an independent page without retaining a cursor between RPCs. -// Supported sources are find/read-only aggregate command documents and HTTP -// _search requests. Documents have the same native result shape as Scan. -// Use a stable native sort with a unique tie-breaker for predictable pages. -// Concurrent changes may shift results; pagination does not provide a snapshot. -message QueryRequest { - Command command = 1; - - // One-based page number; zero selects page 1. Deep pages still incur backend - // offset costs and are subject to the backend's result-window limits. - uint32 page = 2; - - // Zero selects 100; maximum 1000. Query replaces native find skip/limit and - // HTTP from/size. For aggregate, pagination follows the supplied pipeline. - uint32 page_size = 3; - - // Ordered sort keys. Empty preserves the native sort; nonempty replaces find - // or HTTP sorting. For aggregate, sort follows the supplied pipeline. - repeated SortField sort = 4; - - // Absent preserves native projection. Present replaces find projection or - // HTTP _source selection; aggregate applies it after the pipeline and sort, - // before pagination. An empty fields list selects all document fields. - Projection projection = 5; -} - -message SortField { - string field = 1; - bool descending = 2; -} - -// Field names are native document paths (relative to _source for HTTP search). -// HTTP hit metadata is unchanged. Document stores retain their native rules for -// identity-field projection. -// Database-specific computed projections can remain in Command.payload. -message Projection { - repeated string fields = 1; - bool exclude = 2; // False includes listed fields; true excludes them. -} - -// Document frames contain one document. A final, document-free frame sets -// complete and has_more. Metadata is valid only after successful EOF. -message QueryResponse { - repeated Document documents = 1; - - // Determined by fetching one extra result, not by running Count. Result-window - // limits apply to this extra result too. A byte limit fails the whole request; - // it never produces a silently shortened page. - bool has_more = 2; - bool complete = 3; -} - -// Count is an independent query, not an implicit part of Query. It accepts the -// same sources and counts matches before find/HTTP pagination; for aggregate it -// counts the output of the supplied pipeline. HTTP counts matching documents -// before collapse. Partial or timed-out counts fail the request. -// Count and Query are separate observations and may differ under concurrent writes. -message CountRequest { - // MongoDB find with an absent or empty filter automatically uses collection - // metadata when no options require exact execution. Filtered queries, - // aggregate pipelines and HTTP search counts remain exact. - Command command = 1; -} - -message CountResponse { - uint64 count = 1; - // True when the backend used an estimate instead of counting matching rows. - bool estimated = 2; -} - -// Scan returns one live page. Supply the same Command and Projection and pass -// next_cursor back as cursor after processing a page. Cursors carry the seek -// position across server restarts and do not expire; no database session -// survives a request. Task deadlines and checkpoint retention belong to callers. -// Concurrent changes can affect later pages and retries. Scan is not a snapshot. -message ScanRequest { - Command command = 1; - - // Zero selects 100; maximum 1000. The byte limit may produce a smaller page. - uint32 batch_size = 2; - - // Empty starts a new scan. Treat this continuation marker as opaque; it is - // bound to Command and Projection and is not an authorization credential. - bytes cursor = 3; - - // Absent preserves native projection. Present replaces find projection or - // HTTP _source selection. Empty fields selects all document fields. MongoDB - // retains _id internally for continuation even when excluded from results; - // HTTP hit metadata and sort values are unchanged. - Projection projection = 4; -} - -// Documents retain native encodings: BSON documents or complete JSON hits. -// A failed stream may have delivered documents but never a committed page. -// Resume from the last saved cursor with idempotent business processing. -// Document frames contain one document. A final, document-free frame sets -// complete and next_cursor. Checkpoint only after successful EOF. -message ScanResponse { - repeated Document documents = 1; - - // Empty means the scan reached the end observed by this request. Commit a - // checkpoint only after processing documents and successful EOF. No close RPC is needed. - bytes next_cursor = 2; - bool complete = 3; -} diff --git a/query.go b/query.go index ea90fc5..d8c8c63 100644 --- a/query.go +++ b/query.go @@ -8,7 +8,7 @@ import ( "strings" "unicode/utf8" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" ) type QueryRequest struct { diff --git a/query_test.go b/query_test.go index 81d6579..f94cbb7 100644 --- a/query_test.go +++ b/query_test.go @@ -8,7 +8,7 @@ import ( "testing" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/request_helpers_test.go b/request_helpers_test.go index e253107..3ae7e24 100644 --- a/request_helpers_test.go +++ b/request_helpers_test.go @@ -4,7 +4,7 @@ import ( "testing" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" ) func TestRequestCompletionDefaultsAndOverridesReachRPC(t *testing.T) { diff --git a/results.go b/results.go index 13ef244..1dff66c 100644 --- a/results.go +++ b/results.go @@ -3,7 +3,7 @@ package sink import ( "fmt" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" ) func decodeReadResult(protoResult *sinkv1.ReadResult, index int) (ReadResult, error) { diff --git a/scan_deadline_test.go b/scan_deadline_test.go index 3c4df93..cc37c9c 100644 --- a/scan_deadline_test.go +++ b/scan_deadline_test.go @@ -7,7 +7,7 @@ import ( "time" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" ) type scanDeadlineServer struct { diff --git a/scan_projection_test.go b/scan_projection_test.go index d90832a..2ae60d3 100644 --- a/scan_projection_test.go +++ b/scan_projection_test.go @@ -5,7 +5,7 @@ import ( "testing" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" ) func TestScanProjectionWirePresenceAndValidation(t *testing.T) { diff --git a/scan_retry_test.go b/scan_retry_test.go index 00a9cd0..24542b5 100644 --- a/scan_retry_test.go +++ b/scan_retry_test.go @@ -6,7 +6,7 @@ import ( "time" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/streaming_test.go b/streaming_test.go index 11e3910..8aa373f 100644 --- a/streaming_test.go +++ b/streaming_test.go @@ -8,7 +8,7 @@ import ( "time" sink "github.com/batchstream/sink-go" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/types.go b/types.go index 043cbc0..537b9ae 100644 --- a/types.go +++ b/types.go @@ -8,9 +8,9 @@ import ( "errors" "fmt" - "github.com/batchstream/sink-go/uri" + "github.com/batchstream/sink-protocol/uri" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "go.mongodb.org/mongo-driver/v2/bson" ) diff --git a/uri/address.go b/uri/address.go deleted file mode 100644 index 6a7c5c4..0000000 --- a/uri/address.go +++ /dev/null @@ -1,119 +0,0 @@ -// Package uri defines Sink's canonical, backend-independent resource addresses. -// Store adapters interpret path segments; routing compares the complete URI. -package uri - -import ( - "errors" - "fmt" - "net/url" - "strings" - "unicode/utf8" -) - -const MaxAddressBytes = 16 << 10 - -// Address is immutable. Store adapters interpret its resource path. -// Record addresses use the complete URI as identity. -type Address struct { - value string - store string - segments []string -} - -func ValidStore(value string) bool { - if len(value) == 0 || len(value) > 256 { - return false - } - for i, c := range []byte(value) { - if c >= 'a' && c <= 'z' || c >= '0' && c <= '9' { - continue - } - if i > 0 && (c == '-' || c == '_' || c == '.') { - continue - } - return false - } - return true -} - -// Parse accepts only the canonical spelling. It never cleans paths, resolves -// aliases, interprets key types, or applies backend-specific normalization. -func Parse(value string) (Address, error) { - var empty Address - if len(value) > MaxAddressBytes { - return empty, errors.New("sink URI exceeds 16 KiB") - } - remainder, ok := strings.CutPrefix(value, "sink://") - if !ok { - return empty, errors.New("address must use sink://") - } - store, path, found := strings.Cut(remainder, "/") - if !ValidStore(store) { - return empty, errors.New("store must use lowercase ASCII letters, digits, dots, underscores or hyphens") - } - if !found { - address := Address{value: value, store: store} - return address, nil - } - if path == "" { - return empty, errors.New("use sink://store for a root URI") - } - encoded := strings.Split(path, "/") - segments := make([]string, len(encoded)) - for i, part := range encoded { - decoded, err := url.PathUnescape(part) - if err != nil { - return empty, fmt.Errorf("invalid URI escape: %w", err) - } - if !validSegment(decoded) { - return empty, errors.New("URI segments must be nonempty UTF-8 and cannot be dot segments") - } - if url.PathEscape(decoded) != part { - return empty, errors.New("sink URI is not canonical; construct it with the URI builder") - } - segments[i] = decoded - } - address := Address{value: value, store: store, segments: segments} - return address, nil -} - -func New(store string, segments []string) (Address, error) { - if len(segments) == 0 { - return Parse("sink://" + store) - } - encoded := make([]string, len(segments)) - for i, segment := range segments { - encoded[i] = url.PathEscape(segment) - } - return Parse("sink://" + store + "/" + strings.Join(encoded, "/")) -} - -func validSegment(value string) bool { - if value == "" || value == "." || value == ".." || !utf8.ValidString(value) { - return false - } - return true -} - -func (a Address) String() string { return a.value } -func (a Address) Store() string { return a.store } -func (a Address) Segments() []string { return append([]string(nil), a.segments...) } -func (a Address) RoutingKey() string { return a.value } - -// EscapedPath preserves canonical path encoding. An empty path targets the Store. -func (a Address) EscapedPath() string { return strings.TrimPrefix(a.value, "sink://"+a.store) } - -// AppendKey uses the typed-key convention supported by the built-in stores. -// Custom stores may define other path grammars and construct addresses with New. -func AppendKey(resource string, key Key) (Address, error) { - var empty Address - base, err := Parse(resource) - if err != nil { - return empty, err - } - segment, err := FormatKey(key) - if err != nil { - return empty, err - } - return Parse(base.String() + "/" + url.PathEscape(segment)) -} diff --git a/uri/address_test.go b/uri/address_test.go deleted file mode 100644 index 5e02b9f..0000000 --- a/uri/address_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package uri - -import ( - "bytes" - "testing" -) - -func TestURIIsCanonicalAndOpaque(t *testing.T) { - segments := []string{"数据库", "collection", "s:a/b%?#\x00"} - address, err := New("catalog", segments) - if err != nil { - t.Fatal(err) - } - parsed, err := Parse(address.String()) - if err != nil { - t.Fatal(err) - } - if parsed.Store() != "catalog" || parsed.Segments()[2] != segments[2] { - t.Fatal(parsed) - } - copy := parsed.Segments() - copy[0] = "changed" - if parsed.Segments()[0] != segments[0] { - t.Fatal("mutable address") - } - for _, value := range []string{"http://catalog/a", "sink://Catalog/a", "sink://catalog/", "sink://catalog/a/", "sink://catalog/a//b", "sink://catalog/../b", "sink://catalog/a?query", "sink://catalog/a#fragment", "sink://catalog/%61", "sink://catalog/a%2fb", "sink://user@catalog/a", "sink://catalog:8080/a", "sink://catalog/%ff"} { - if _, err := Parse(value); err == nil { - t.Errorf("accepted noncanonical URI %q", value) - } - } -} - -func TestTypedKeyRoundTripAndIdentity(t *testing.T) { - keys := []Key{StringKey("123"), Int64Key(123), BytesKey([]byte("123")), OpaqueKey("mongodb/object-id", []byte("123")), StringKey(""), StringKey("a/b?c#d%\x00"), Int64Key(-9223372036854775808), BytesKey([]byte{0, 255})} - seen := make(map[string]bool) - for _, key := range keys { - address, err := AppendKey("sink://catalog/db/items", key) - if err != nil { - t.Fatal(err) - } - if seen[address.String()] { - t.Fatal("key types collided") - } - seen[address.String()] = true - segments := address.Segments() - parsed, err := ParseKey(segments[len(segments)-1]) - if err != nil || parsed.Type != key.Type || !bytes.Equal(parsed.Data, key.Data) { - t.Fatalf("round trip %v: %v %v", key, parsed, err) - } - } - for _, segment := range []string{"i:01", "i:+1", "i:-0", "i:9223372036854775808", "b:YQ==", "b:YR", "o::YQ", "x:123", "123"} { - if _, err := ParseKey(segment); err == nil { - t.Errorf("accepted noncanonical key %q", segment) - } - } -} - -func FuzzCanonicalURI(f *testing.F) { - f.Add("catalog", "db", "a/b?c#d%") - f.Fuzz(func(t *testing.T, store, resource, value string) { - key := StringKey(value) - base, err := New(store, []string{resource}) - if err != nil { - return - } - address, err := AppendKey(base.String(), key) - if err != nil { - return - } - parsed, err := Parse(address.String()) - if err != nil || parsed.String() != address.String() { - t.Fatal("unstable canonical URI") - } - parts := parsed.Segments() - decoded, err := ParseKey(parts[len(parts)-1]) - if err != nil || decoded.Type != key.Type || !bytes.Equal(decoded.Data, key.Data) { - t.Fatal("key did not round trip") - } - }) -} diff --git a/uri/key.go b/uri/key.go deleted file mode 100644 index c31f2c6..0000000 --- a/uri/key.go +++ /dev/null @@ -1,112 +0,0 @@ -package uri - -import ( - "bytes" - "encoding/base64" - "encoding/binary" - "errors" - "strconv" - "strings" - "unicode/utf8" -) - -// Key preserves the exact type and bytes used by the built-in Store adapters. -type Key struct { - Type string - Data []byte -} - -func StringKey(value string) Key { - key := Key{Type: "string", Data: []byte(value)} - return key -} - -func Int64Key(value int64) Key { - data := make([]byte, 8) - binary.BigEndian.PutUint64(data, uint64(value)) - key := Key{Type: "int64", Data: data} - return key -} - -func BytesKey(value []byte) Key { - key := Key{Type: "bytes", Data: bytes.Clone(value)} - return key -} - -func OpaqueKey(kind string, value []byte) Key { - key := Key{Type: "opaque:" + kind, Data: bytes.Clone(value)} - return key -} - -func FormatKey(key Key) (string, error) { - switch key.Type { - case "string": - if !utf8.Valid(key.Data) { - return "", errors.New("string key must contain UTF-8; use bytes for binary keys") - } - return "s:" + string(key.Data), nil - case "int64": - if len(key.Data) != 8 { - return "", errors.New("int64 key requires eight bytes") - } - return "i:" + strconv.FormatInt(int64(binary.BigEndian.Uint64(key.Data)), 10), nil - case "bytes": - return "b:" + base64.RawURLEncoding.EncodeToString(key.Data), nil - default: - kind, ok := strings.CutPrefix(key.Type, "opaque:") - if !ok || kind == "" || !utf8.ValidString(kind) { - return "", errors.New("unsupported key type") - } - return "o:" + base64.RawURLEncoding.EncodeToString([]byte(kind)) + ":" + base64.RawURLEncoding.EncodeToString(key.Data), nil - } -} - -func ParseKey(segment string) (Key, error) { - var empty Key - tag, value, ok := strings.Cut(segment, ":") - if !ok { - return empty, errors.New("record key requires a type tag") - } - var key Key - var err error - switch tag { - case "s": - key.Type = "string" - key.Data = []byte(value) - case "b": - key.Type = "bytes" - key.Data, err = base64.RawURLEncoding.Strict().DecodeString(value) - case "i": - var number int64 - number, err = strconv.ParseInt(value, 10, 64) - key.Type = "int64" - key.Data = make([]byte, 8) - binary.BigEndian.PutUint64(key.Data, uint64(number)) - case "o": - kind, encoded, found := strings.Cut(value, ":") - if !found { - return empty, errors.New("opaque key requires type and data") - } - var decoded []byte - decoded, err = base64.RawURLEncoding.Strict().DecodeString(kind) - if err != nil { - return empty, err - } - key.Type = "opaque:" + string(decoded) - key.Data, err = base64.RawURLEncoding.Strict().DecodeString(encoded) - default: - return empty, errors.New("unknown record key type tag") - } - if err != nil { - return empty, err - } - canonical, err := FormatKey(key) - if err != nil { - return empty, err - } - if canonical != segment { - return empty, errors.New("record key is not canonical") - } - key.Data = bytes.Clone(key.Data) - return key, nil -} diff --git a/uri/root_test.go b/uri/root_test.go deleted file mode 100644 index 12864c8..0000000 --- a/uri/root_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package uri - -import "testing" - -func TestRootResourceURIIsCanonical(t *testing.T) { - address, err := New("search", nil) - if err != nil || address.String() != "sink://search" || address.Store() != "search" || len(address.Segments()) != 0 || address.EscapedPath() != "" { - t.Fatalf("invalid Store resource: %+v %v", address, err) - } - for _, value := range []string{"sink://search/", "sink://search?x=y", "sink://search#x", "sink://search/products/"} { - if _, err := Parse(value); err == nil { - t.Errorf("accepted noncanonical resource %q", value) - } - } -} diff --git a/vtproto_test.go b/vtproto_test.go index ca66302..e96d029 100644 --- a/vtproto_test.go +++ b/vtproto_test.go @@ -4,9 +4,9 @@ import ( "testing" "github.com/batchstream/sink-go/internal/testuri" - "github.com/batchstream/sink-go/uri" + "github.com/batchstream/sink-protocol/uri" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" "google.golang.org/grpc" "google.golang.org/grpc/encoding" ) diff --git a/wire.go b/wire.go index 221bad0..335be0a 100644 --- a/wire.go +++ b/wire.go @@ -4,7 +4,7 @@ import ( "bytes" "fmt" - sinkv1 "github.com/batchstream/sink-go/api/sink/v1" + sinkv1 "github.com/batchstream/sink-protocol/sink/v1" ) func (a Address) toProto() *sinkv1.RecordAddress {