From c88d1fdae3e8a6c8037a0e9a2d1c08236663cff4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 5 Aug 2020 21:21:26 +0300 Subject: [PATCH] query: Move Query to object Move Query message definition to object package since it is only used there. Package query is completely removed from the repository. Signed-off-by: Leonard Lyubich --- object/service.proto | 26 +++++++++++--- proto-docs/object.md | 42 ++++++++++++++++++++-- proto-docs/query.md | 86 -------------------------------------------- query/types.proto | 33 ----------------- 4 files changed, 62 insertions(+), 125 deletions(-) delete mode 100644 proto-docs/query.md delete mode 100644 query/types.proto diff --git a/object/service.proto b/object/service.proto index f1b94e6..735bb39 100644 --- a/object/service.proto +++ b/object/service.proto @@ -140,10 +140,28 @@ message HeadResponse { message SearchRequest { // ContainerID carries search container identifier. refs.ContainerID ContainerID = 1; - // Query in the binary serialized format - bytes Query = 2; - // QueryVersion is a version of search query format - uint32 QueryVersion = 3; + + message Query { + uint32 Version = 1; + + message Filter { + enum MatchType { + MatchUnknown = 0; + StringEqual = 1; + } + + MatchType matchType = 1; + + string Name = 2; + + string Value = 3; + } + + repeated Filter Filters = 2; + } + + Query query = 2; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) diff --git a/proto-docs/object.md b/proto-docs/object.md index 9a84732..d6c98b4 100644 --- a/proto-docs/object.md +++ b/proto-docs/object.md @@ -23,6 +23,8 @@ - [PutResponse](#object.PutResponse) - [Range](#object.Range) - [SearchRequest](#object.SearchRequest) + - [SearchRequest.Query](#object.SearchRequest.Query) + - [SearchRequest.Query.Filter](#object.SearchRequest.Query.Filter) - [SearchResponse](#object.SearchResponse) @@ -328,12 +330,36 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | ContainerID | [refs.ContainerID](#refs.ContainerID) | | ContainerID carries search container identifier. | -| Query | [bytes](#bytes) | | Query in the binary serialized format | -| QueryVersion | [uint32](#uint32) | | QueryVersion is a version of search query format | +| query | [SearchRequest.Query](#object.SearchRequest.Query) | | | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + + +### Message SearchRequest.Query + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Version | [uint32](#uint32) | | | +| Filters | [SearchRequest.Query.Filter](#object.SearchRequest.Query.Filter) | repeated | | + + + + +### Message SearchRequest.Query.Filter + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| matchType | [SearchRequest.Query.Filter.MatchType](#object.SearchRequest.Query.Filter.MatchType) | | | +| Name | [string](#string) | | | +| Value | [string](#string) | | | + + ### Message SearchResponse @@ -347,6 +373,18 @@ in distributed system. + + + +### SearchRequest.Query.Filter.MatchType + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| MatchUnknown | 0 | | +| StringEqual | 1 | | + + diff --git a/proto-docs/query.md b/proto-docs/query.md deleted file mode 100644 index c014c6c..0000000 --- a/proto-docs/query.md +++ /dev/null @@ -1,86 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [query/types.proto](#query/types.proto) - - - Messages - - [Filter](#query.Filter) - - [Query](#query.Query) - - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## query/types.proto - - - - - - - -### Message Filter - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| type | [Filter.Type](#query.Filter.Type) | | Type of filter | -| Name | [string](#string) | | Name of field that should be filtered | -| Value | [string](#string) | | Value that should be used for filter | - - - - -### Message Query - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Filters | [Filter](#query.Filter) | repeated | Filters is set of filters, should not be empty | - - - - - - -### Filter.Type - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Exact | 0 | Exact sets when value of filter should be equal to the header value | -| Regex | 1 | Regex sets when value of filter should match the header value by the regular expression | - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ Type | Java Type | Python Type | -| ----------- | ----- | -------- | --------- | ----------- | -| double | | double | double | float | -| float | | float | float | float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | -| sfixed32 | Always four bytes. | int32 | int | int | -| sfixed64 | Always eight bytes. | int64 | long | int/long | -| bool | | bool | boolean | boolean | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | - diff --git a/query/types.proto b/query/types.proto deleted file mode 100644 index ebc0d64..0000000 --- a/query/types.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; -package query; -option go_package = "github.com/nspcc-dev/neofs-api-go/query"; -option csharp_namespace = "NeoFS.API.Query"; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -message Filter { - option (gogoproto.goproto_stringer) = false; - - enum Type { - // Exact sets when value of filter should be equal to the header value - Exact = 0; - // Regex sets when value of filter should match the header value by the regular expression - Regex = 1; - } - - // Type of filter - Type type = 1 [(gogoproto.customname) = "Type"]; - // Name of field that should be filtered - string Name = 2; - // Value that should be used for filter - string Value = 3; -} - -message Query { - option (gogoproto.goproto_stringer) = false; - - // Filters is set of filters, should not be empty - repeated Filter Filters = 1 [(gogoproto.nullable) = false]; -}