From 61270cb7196ffc3068a1226dc5a32f57b1b11836 Mon Sep 17 00:00:00 2001 From: Kevin Joiner <10265309+KevinJoiner@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:20:53 -0500 Subject: [PATCH] Update name indexer and send back cloudevents --- docs/docs.go | 46 ++- docs/swagger.json | 46 ++- docs/swagger.yaml | 53 ++- go.mod | 20 +- go.sum | 45 +- internal/fetch/fetch.go | 14 +- internal/fetch/httphandler/httphandler.go | 4 +- internal/fetch/rpc/rpc.go | 53 ++- pkg/grpc/cloudevent.pb.go | 354 ++++++++++++++++ pkg/grpc/cloudevent.proto | 59 +++ pkg/grpc/common.go | 40 ++ pkg/grpc/fetch-api.pb.go | 475 +++++++++------------- pkg/grpc/fetch-api.proto | 16 +- 13 files changed, 879 insertions(+), 346 deletions(-) create mode 100644 pkg/grpc/cloudevent.pb.go create mode 100644 pkg/grpc/cloudevent.proto create mode 100644 pkg/grpc/common.go diff --git a/docs/docs.go b/docs/docs.go index fc44343..2849d1b 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -255,7 +255,7 @@ const docTemplate = `{ "200": { "description": "Returns latest object data", "schema": { - "$ref": "#/definitions/indexrepo.DataObject" + "$ref": "#/definitions/cloudevent.CloudEvent-json_RawMessage" } }, "400": { @@ -337,7 +337,7 @@ const docTemplate = `{ "schema": { "type": "array", "items": { - "$ref": "#/definitions/indexrepo.DataObject" + "$ref": "#/definitions/cloudevent.CloudEvent-json_RawMessage" } } }, @@ -364,16 +364,54 @@ const docTemplate = `{ } }, "definitions": { - "indexrepo.DataObject": { + "cloudevent.CloudEvent-json_RawMessage": { "type": "object", "properties": { "data": { + "description": "Data contains domain-specific information about the event.", "type": "array", "items": { "type": "integer" } }, - "indexKey": { + "datacontenttype": { + "description": "DataContentType is an optional MIME type for the data field. We almost\nalways serialize to JSON and in that case this field is implicitly\n\"application/json\".", + "type": "string" + }, + "dataschema": { + "description": "DataSchema is an optional URI pointing to a schema for the data field.", + "type": "string" + }, + "dataversion": { + "description": "DataVersion is the version of the data type.", + "type": "string" + }, + "id": { + "description": "ID is an identifier for the event. The combination of ID and Source must\nbe unique.", + "type": "string" + }, + "producer": { + "description": "Producer is a specific instance, process or device that creates the data structure describing the CloudEvent.", + "type": "string" + }, + "source": { + "description": "Source is the context in which the event happened. In a distributed system it might consist of multiple Producers.", + "type": "string" + }, + "specversion": { + "description": "SpecVersion is the version of CloudEvents specification used.\nThis is always hardcoded \"1.0\".", + "type": "string" + }, + "subject": { + "description": "Subject is an optional field identifying the subject of the event within\nthe context of the event producer. In practice, we always set this.", + "type": "string" + }, + "time": { + "description": "Time is an optional field giving the time at which the event occurred. In\npractice, we always set this.", + "type": "string" + }, + "type": { + "description": "Type describes the type of event. It should generally be a reverse-DNS\nname.", "type": "string" } } diff --git a/docs/swagger.json b/docs/swagger.json index 49df94e..63f82a2 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -246,7 +246,7 @@ "200": { "description": "Returns latest object data", "schema": { - "$ref": "#/definitions/indexrepo.DataObject" + "$ref": "#/definitions/cloudevent.CloudEvent-json_RawMessage" } }, "400": { @@ -328,7 +328,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/indexrepo.DataObject" + "$ref": "#/definitions/cloudevent.CloudEvent-json_RawMessage" } } }, @@ -355,16 +355,54 @@ } }, "definitions": { - "indexrepo.DataObject": { + "cloudevent.CloudEvent-json_RawMessage": { "type": "object", "properties": { "data": { + "description": "Data contains domain-specific information about the event.", "type": "array", "items": { "type": "integer" } }, - "indexKey": { + "datacontenttype": { + "description": "DataContentType is an optional MIME type for the data field. We almost\nalways serialize to JSON and in that case this field is implicitly\n\"application/json\".", + "type": "string" + }, + "dataschema": { + "description": "DataSchema is an optional URI pointing to a schema for the data field.", + "type": "string" + }, + "dataversion": { + "description": "DataVersion is the version of the data type.", + "type": "string" + }, + "id": { + "description": "ID is an identifier for the event. The combination of ID and Source must\nbe unique.", + "type": "string" + }, + "producer": { + "description": "Producer is a specific instance, process or device that creates the data structure describing the CloudEvent.", + "type": "string" + }, + "source": { + "description": "Source is the context in which the event happened. In a distributed system it might consist of multiple Producers.", + "type": "string" + }, + "specversion": { + "description": "SpecVersion is the version of CloudEvents specification used.\nThis is always hardcoded \"1.0\".", + "type": "string" + }, + "subject": { + "description": "Subject is an optional field identifying the subject of the event within\nthe context of the event producer. In practice, we always set this.", + "type": "string" + }, + "time": { + "description": "Time is an optional field giving the time at which the event occurred. In\npractice, we always set this.", + "type": "string" + }, + "type": { + "description": "Type describes the type of event. It should generally be a reverse-DNS\nname.", "type": "string" } } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index d5e96f9..5748041 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,11 +1,56 @@ definitions: - indexrepo.DataObject: + cloudevent.CloudEvent-json_RawMessage: properties: data: + description: Data contains domain-specific information about the event. items: type: integer type: array - indexKey: + datacontenttype: + description: |- + DataContentType is an optional MIME type for the data field. We almost + always serialize to JSON and in that case this field is implicitly + "application/json". + type: string + dataschema: + description: DataSchema is an optional URI pointing to a schema for the data + field. + type: string + dataversion: + description: DataVersion is the version of the data type. + type: string + id: + description: |- + ID is an identifier for the event. The combination of ID and Source must + be unique. + type: string + producer: + description: Producer is a specific instance, process or device that creates + the data structure describing the CloudEvent. + type: string + source: + description: Source is the context in which the event happened. In a distributed + system it might consist of multiple Producers. + type: string + specversion: + description: |- + SpecVersion is the version of CloudEvents specification used. + This is always hardcoded "1.0". + type: string + subject: + description: |- + Subject is an optional field identifying the subject of the event within + the context of the event producer. In practice, we always set this. + type: string + time: + description: |- + Time is an optional field giving the time at which the event occurred. In + practice, we always set this. + type: string + type: + description: |- + Type describes the type of event. It should generally be a reverse-DNS + name. type: string type: object internal_fetch_httphandler.indexKeyResponse: @@ -180,7 +225,7 @@ paths: "200": description: Returns latest object data schema: - $ref: '#/definitions/indexrepo.DataObject' + $ref: '#/definitions/cloudevent.CloudEvent-json_RawMessage' "400": description: Invalid request schema: @@ -233,7 +278,7 @@ paths: description: Returns latest object data schema: items: - $ref: '#/definitions/indexrepo.DataObject' + $ref: '#/definitions/cloudevent.CloudEvent-json_RawMessage' type: array "400": description: Invalid request diff --git a/go.mod b/go.mod index 0e9185e..4c337d2 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.23 require ( github.com/ClickHouse/clickhouse-go/v2 v2.30.0 github.com/DIMO-Network/clickhouse-infra v0.0.3 - github.com/DIMO-Network/model-garage v0.3.3 - github.com/DIMO-Network/nameindexer v0.0.10-0.20241031131836-425572ba4fe9 + github.com/DIMO-Network/model-garage v0.4.2 + github.com/DIMO-Network/nameindexer v0.0.12-0.20241126175909-94075d731767 github.com/DIMO-Network/shared v0.11.1 github.com/aws/aws-sdk-go-v2 v1.32.2 github.com/aws/aws-sdk-go-v2/credentials v1.17.27 @@ -23,7 +23,7 @@ require ( github.com/rs/zerolog v1.33.0 github.com/stretchr/testify v1.9.0 github.com/swaggo/swag v1.16.4 - golang.org/x/sync v0.8.0 + golang.org/x/sync v0.9.0 google.golang.org/grpc v1.65.0 google.golang.org/protobuf v1.34.2 ) @@ -78,6 +78,10 @@ require ( github.com/shopspring/decimal v1.4.0 // indirect github.com/spf13/cast v1.7.0 // indirect github.com/swaggo/files/v2 v2.0.0 // indirect + github.com/tidwall/gjson v1.18.0 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/tidwall/sjson v1.2.5 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.55.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect @@ -86,12 +90,12 @@ require ( github.com/volatiletech/strmangle v0.0.6 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect - golang.org/x/crypto v0.28.0 // indirect + golang.org/x/crypto v0.29.0 // indirect golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect - golang.org/x/net v0.30.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.26.0 // indirect + golang.org/x/net v0.31.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/text v0.20.0 // indirect + golang.org/x/tools v0.27.0 // indirect golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240725223205-93522f1f2a9f // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index ff64361..4e17221 100644 --- a/go.sum +++ b/go.sum @@ -72,10 +72,10 @@ github.com/DATA-DOG/go-sqlmock v1.4.1 h1:ThlnYciV1iM/V0OSF/dtkqWb6xo5qITT1TJBG1M github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DIMO-Network/clickhouse-infra v0.0.3 h1:B6/4IY9IxLcyydET14IjHUT+A5SDEis7p//DoFzrMk4= github.com/DIMO-Network/clickhouse-infra v0.0.3/go.mod h1:NtpQ1btkPzebDvpYYygeqiiBmJ/q5oJb/T/JWzUVRlk= -github.com/DIMO-Network/model-garage v0.3.3 h1:Mb6wz1siYiZC20aoQwoSawzjXQqIvBhIsY4kKP63RSg= -github.com/DIMO-Network/model-garage v0.3.3/go.mod h1:TKajLKnkYw7n6cUuay6CBS15b81jVHRsQshW2WHeXzM= -github.com/DIMO-Network/nameindexer v0.0.10-0.20241031131836-425572ba4fe9 h1:EjmGhmuPDxWCYOJSFFASdNBXxfedTSwfaZIBAdA0PW8= -github.com/DIMO-Network/nameindexer v0.0.10-0.20241031131836-425572ba4fe9/go.mod h1:+X3K7NN7/DTwkwex5G0e+cqyUaGoCqqk8otOyjDxN+s= +github.com/DIMO-Network/model-garage v0.4.2 h1:TF+RNC1n1Y58QSdzmKaf5REixdariAP4tqHihzjSe70= +github.com/DIMO-Network/model-garage v0.4.2/go.mod h1:SXaBHFFARooOEoaV1wFaOC1K0LMt0bovkILsFXoUQTg= +github.com/DIMO-Network/nameindexer v0.0.12-0.20241126175909-94075d731767 h1:KZc2t4eIFuIwxztUstDxeAu87FKL4QQrNEbkO0VKQDU= +github.com/DIMO-Network/nameindexer v0.0.12-0.20241126175909-94075d731767/go.mod h1:Hd+vs7PCqSIdAdkcHprdqQjsMED5fuiHP6TNKdqUajs= github.com/DIMO-Network/shared v0.11.1 h1:LpI2rROKjrBo6KO76sU3dZDvSv4YbQ4XUBEC4P5NosM= github.com/DIMO-Network/shared v0.11.1/go.mod h1:lm7rUB5i7Jx7t3EomtCwep0aC+sB+nlYYTJkTdUeKHM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -641,7 +641,16 @@ github.com/testcontainers/testcontainers-go v0.33.0 h1:zJS9PfXYT5O0ZFXM2xxXfk4J5 github.com/testcontainers/testcontainers-go v0.33.0/go.mod h1:W80YpTa8D5C3Yy16icheD01UTDu+LmXIA2Keo+jWtT8= github.com/testcontainers/testcontainers-go/modules/clickhouse v0.33.0 h1:YbB5DBkpgY+GlGPFqTSV1hzWPm3ZHirEyooZrj+ZXK0= github.com/testcontainers/testcontainers-go/modules/clickhouse v0.33.0/go.mod h1:qJuMPl9yWIWasmdBILM2uDk1Ny1kdeigcKMJ6A8PZz0= +github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= +github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= +github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -723,8 +732,8 @@ golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= +golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -763,8 +772,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= -golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -815,8 +824,8 @@ golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= +golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -850,8 +859,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -939,8 +948,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -952,8 +961,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1015,8 +1024,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o= +golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/fetch/fetch.go b/internal/fetch/fetch.go index 86cfcbf..25f3000 100644 --- a/internal/fetch/fetch.go +++ b/internal/fetch/fetch.go @@ -3,16 +3,18 @@ package fetch import ( "context" + "encoding/json" "errors" "fmt" + "github.com/DIMO-Network/model-garage/pkg/cloudevent" "github.com/DIMO-Network/nameindexer/pkg/clickhouse/indexrepo" "github.com/aws/aws-sdk-go-v2/service/s3/types" ) // GetObjectsFromIndexs gets objects from the index service by trying to get them from each bucket in the list returning the first successful result. -func GetObjectsFromIndexs(ctx context.Context, idxSvc *indexrepo.Service, indexKeys []string, buckets []string) ([]indexrepo.DataObject, error) { - dataObjects := make([]indexrepo.DataObject, 0, len(indexKeys)) +func GetObjectsFromIndexs(ctx context.Context, idxSvc *indexrepo.Service, indexKeys []string, buckets []string) ([]cloudevent.CloudEvent[json.RawMessage], error) { + dataObjects := make([]cloudevent.CloudEvent[json.RawMessage], 0, len(indexKeys)) for _, key := range indexKeys { obj, err := GetObjectFromIndex(ctx, idxSvc, key, buckets) if err != nil { @@ -24,8 +26,8 @@ func GetObjectsFromIndexs(ctx context.Context, idxSvc *indexrepo.Service, indexK } // GetObjectFromIndex gets an object from the index service by trying to get it from each bucket in the list returning the first successful result. -func GetObjectFromIndex(ctx context.Context, idxSvc *indexrepo.Service, indexKeys string, buckets []string) (indexrepo.DataObject, error) { - var obj indexrepo.DataObject +func GetObjectFromIndex(ctx context.Context, idxSvc *indexrepo.Service, indexKeys string, buckets []string) (cloudevent.CloudEvent[json.RawMessage], error) { + var obj cloudevent.CloudEvent[json.RawMessage] var err error // Try to get the object from each bucket in the list for _, bucket := range buckets { @@ -35,9 +37,9 @@ func GetObjectFromIndex(ctx context.Context, idxSvc *indexrepo.Service, indexKey if errors.As(err, ¬FoundErr) { continue } - return indexrepo.DataObject{}, fmt.Errorf("failed to get object: %w", err) + return cloudevent.CloudEvent[json.RawMessage]{}, fmt.Errorf("failed to get object: %w", err) } return obj, nil } - return indexrepo.DataObject{}, fmt.Errorf("failed to get object: %w", err) + return cloudevent.CloudEvent[json.RawMessage]{}, fmt.Errorf("failed to get object: %w", err) } diff --git a/internal/fetch/httphandler/httphandler.go b/internal/fetch/httphandler/httphandler.go index 583d25b..ad67924 100644 --- a/internal/fetch/httphandler/httphandler.go +++ b/internal/fetch/httphandler/httphandler.go @@ -161,7 +161,7 @@ func (h *Handler) GetIndexKeys(fCtx *fiber.Ctx) error { // @Produce json // @Param params query searchParams false "Search parameters" // @Param tokenId path string true "Token ID" -// @Success 200 {object} []indexrepo.DataObject "Returns latest object data" +// @Success 200 {object} []cloudevent.CloudEvent[json.RawMessage] "Returns latest object data" // @Failure 400 {object} map[string]string "Invalid request" // @Failure 500 {object} map[string]string "Server error" // @Router /v1/vehicle/objects/{tokenId} [get] @@ -200,7 +200,7 @@ func (h *Handler) GetObjects(fCtx *fiber.Ctx) error { // @Produce json // @Param params query searchParams false "Search parameters" // @Param tokenId path string true "Token ID" -// @Success 200 {object} indexrepo.DataObject "Returns latest object data" +// @Success 200 {object} cloudevent.CloudEvent[json.RawMessage] "Returns latest object data" // @Failure 400 {object} map[string]string "Invalid request" // @Failure 500 {object} map[string]string "Server error" // @Router /v1/vehicle/latest-object/{tokenId} [get] diff --git a/internal/fetch/rpc/rpc.go b/internal/fetch/rpc/rpc.go index 867a9a8..0912815 100644 --- a/internal/fetch/rpc/rpc.go +++ b/internal/fetch/rpc/rpc.go @@ -3,13 +3,16 @@ package rpc import ( "context" + "encoding/json" "fmt" "time" "github.com/ClickHouse/clickhouse-go/v2" "github.com/DIMO-Network/fetch-api/internal/fetch" "github.com/DIMO-Network/fetch-api/pkg/grpc" + "github.com/DIMO-Network/model-garage/pkg/cloudevent" "github.com/DIMO-Network/nameindexer/pkg/clickhouse/indexrepo" + "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" ) @@ -62,14 +65,11 @@ func (s *Server) GetObjects(ctx context.Context, req *grpc.GetObjectsRequest) (* return nil, fmt.Errorf("failed to get latest object: %w", err) } - dataObjects := make([]*grpc.DataObject, len(data)) + events := make([]*grpc.CloudEvent, len(data)) for i, d := range data { - dataObjects[i] = &grpc.DataObject{ - IndexKey: d.IndexKey, - Data: d.Data, - } + events[i] = cloudEventToProto(d) } - return &grpc.GetObjectsResponse{DataObjects: dataObjects}, nil + return &grpc.GetObjectsResponse{CloudEvents: events}, nil } // GetLatestObject translates the gRPC call to the indexrepo type and fetches the latest data for the given options. @@ -83,10 +83,7 @@ func (s *Server) GetLatestObject(ctx context.Context, req *grpc.GetLatestObjectR if err != nil { return nil, fmt.Errorf("failed to get latest object: %w", err) } - return &grpc.GetLatestObjectResponse{DataObject: &grpc.DataObject{ - IndexKey: latestData.IndexKey, - Data: latestData.Data, - }}, nil + return &grpc.GetLatestObjectResponse{DataObject: cloudEventToProto(latestData)}, nil } // GetObjectsFromIndexKeys translates the gRPC call to the indexrepo type and fetches data for the given options. @@ -95,14 +92,11 @@ func (s *Server) GetObjectsFromIndexKeys(ctx context.Context, req *grpc.GetObjec if err != nil { return nil, fmt.Errorf("failed to get objects: %w", err) } - dataObjects := make([]*grpc.DataObject, len(data)) + dataObjects := make([]*grpc.CloudEvent, len(data)) for i, d := range data { - dataObjects[i] = &grpc.DataObject{ - IndexKey: d.IndexKey, - Data: d.Data, - } + dataObjects[i] = cloudEventToProto(d) } - return &grpc.GetObjectsFromIndexKeysResponse{DataObjects: dataObjects}, nil + return &grpc.GetObjectsFromIndexKeysResponse{CloudEvents: dataObjects}, nil } // translateProtoToSearchOptions translates a SearchOptions proto message to the Go SearchOptions type. @@ -151,3 +145,30 @@ func getStringValue(protoStr *wrapperspb.StringValue) *string { val := protoStr.GetValue() return &val } + +func cloudEventToProto(event cloudevent.CloudEvent[json.RawMessage]) *grpc.CloudEvent { + extras := make(map[string][]byte) + for k, v := range event.Extras { + v, err := json.Marshal(v) + if err != nil { + // Skip the extra if it can't be marshaled + continue + } + extras[k] = v + } + return &grpc.CloudEvent{ + Header: &grpc.CloudEventHeader{ + Id: event.ID, + Source: event.Source, + SpecVersion: event.SpecVersion, + Type: event.Type, + DataContentType: event.DataContentType, + Subject: event.Subject, + Time: timestamppb.New(event.Time), + DataSchema: event.DataSchema, + DataVersion: event.DataVersion, + Extras: extras, + }, + Data: event.Data, + } +} diff --git a/pkg/grpc/cloudevent.pb.go b/pkg/grpc/cloudevent.pb.go new file mode 100644 index 0000000..cde5d22 --- /dev/null +++ b/pkg/grpc/cloudevent.pb.go @@ -0,0 +1,354 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v5.28.3 +// source: pkg/grpc/cloudevent.proto + +package grpc + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// CloudEvent represents a CloudEvent with a header and data. +type CloudEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Header *CloudEventHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *CloudEvent) Reset() { + *x = CloudEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_grpc_cloudevent_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloudEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloudEvent) ProtoMessage() {} + +func (x *CloudEvent) ProtoReflect() protoreflect.Message { + mi := &file_pkg_grpc_cloudevent_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloudEvent.ProtoReflect.Descriptor instead. +func (*CloudEvent) Descriptor() ([]byte, []int) { + return file_pkg_grpc_cloudevent_proto_rawDescGZIP(), []int{0} +} + +func (x *CloudEvent) GetHeader() *CloudEventHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *CloudEvent) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +// CloudEventHeader represents the header structure of a CloudEvent. +type CloudEventHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ID is an identifier for the event. The combination of ID and Source must + // be unique. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Source is the context in which the event happened. In a distributed system it might consist of multiple Producers. + // Typically the 0x address. + Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` + // Producer is a specific instance, process or device that creates the data structure describing the CloudEvent. + // Typically a DID of a nft. + Producer string `protobuf:"bytes,3,opt,name=producer,proto3" json:"producer,omitempty"` + // SpecVersion is the version of CloudEvents specification used. + // This is always hardcoded "1.0". + SpecVersion string `protobuf:"bytes,4,opt,name=spec_version,json=specVersion,proto3" json:"spec_version,omitempty"` + // Subject is an optional field identifying the subject of the event within + // the context of the event producer. + // Typically the DID of the nft. + Subject string `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"` + // Time which the event occurred. + Time *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=time,proto3" json:"time,omitempty"` + // Type describes the type of event. + // Typically a one of the predefined DIMO types. (dimo.status, dimo.fingerprint, dimo.verfiabaleCredential...) + Type string `protobuf:"bytes,7,opt,name=type,proto3" json:"type,omitempty"` + // DataContentType is an optional MIME type for the data field. We almost + // always serialize to JSON and in that case this field is implicitly + // "application/json". + DataContentType string `protobuf:"bytes,8,opt,name=data_content_type,json=dataContentType,proto3" json:"data_content_type,omitempty"` + // DataSchema is an optional URI pointing to a schema for the data field. + DataSchema string `protobuf:"bytes,9,opt,name=data_schema,json=dataSchema,proto3" json:"data_schema,omitempty"` + // DataVersion is the controlled by the source of the event and is used to provide information about the data. + DataVersion string `protobuf:"bytes,10,opt,name=data_version,json=dataVersion,proto3" json:"data_version,omitempty"` + // Extras contains any additional fields that are not part of the CloudEvent excluding the data field. + Extras map[string][]byte `protobuf:"bytes,11,rep,name=extras,proto3" json:"extras,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *CloudEventHeader) Reset() { + *x = CloudEventHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_grpc_cloudevent_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloudEventHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloudEventHeader) ProtoMessage() {} + +func (x *CloudEventHeader) ProtoReflect() protoreflect.Message { + mi := &file_pkg_grpc_cloudevent_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloudEventHeader.ProtoReflect.Descriptor instead. +func (*CloudEventHeader) Descriptor() ([]byte, []int) { + return file_pkg_grpc_cloudevent_proto_rawDescGZIP(), []int{1} +} + +func (x *CloudEventHeader) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CloudEventHeader) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *CloudEventHeader) GetProducer() string { + if x != nil { + return x.Producer + } + return "" +} + +func (x *CloudEventHeader) GetSpecVersion() string { + if x != nil { + return x.SpecVersion + } + return "" +} + +func (x *CloudEventHeader) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +func (x *CloudEventHeader) GetTime() *timestamppb.Timestamp { + if x != nil { + return x.Time + } + return nil +} + +func (x *CloudEventHeader) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *CloudEventHeader) GetDataContentType() string { + if x != nil { + return x.DataContentType + } + return "" +} + +func (x *CloudEventHeader) GetDataSchema() string { + if x != nil { + return x.DataSchema + } + return "" +} + +func (x *CloudEventHeader) GetDataVersion() string { + if x != nil { + return x.DataVersion + } + return "" +} + +func (x *CloudEventHeader) GetExtras() map[string][]byte { + if x != nil { + return x.Extras + } + return nil +} + +var File_pkg_grpc_cloudevent_proto protoreflect.FileDescriptor + +var file_pkg_grpc_cloudevent_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x56, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x34, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x22, 0xc4, 0x03, 0x0a, 0x10, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x70, 0x65, + 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x73, 0x70, 0x65, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, + 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x64, 0x61, + 0x74, 0x61, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x61, 0x74, 0x61, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x61, 0x74, + 0x61, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x61, 0x74, 0x61, 0x5f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, + 0x61, 0x74, 0x61, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x06, 0x65, 0x78, + 0x74, 0x72, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x65, 0x78, 0x74, 0x72, 0x61, 0x73, 0x1a, 0x39, 0x0a, 0x0b, + 0x45, 0x78, 0x74, 0x72, 0x61, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x44, 0x49, 0x4d, 0x4f, 0x2d, 0x4e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x2f, 0x66, 0x65, 0x74, 0x63, 0x68, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pkg_grpc_cloudevent_proto_rawDescOnce sync.Once + file_pkg_grpc_cloudevent_proto_rawDescData = file_pkg_grpc_cloudevent_proto_rawDesc +) + +func file_pkg_grpc_cloudevent_proto_rawDescGZIP() []byte { + file_pkg_grpc_cloudevent_proto_rawDescOnce.Do(func() { + file_pkg_grpc_cloudevent_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_grpc_cloudevent_proto_rawDescData) + }) + return file_pkg_grpc_cloudevent_proto_rawDescData +} + +var file_pkg_grpc_cloudevent_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_pkg_grpc_cloudevent_proto_goTypes = []any{ + (*CloudEvent)(nil), // 0: cloudevent.CloudEvent + (*CloudEventHeader)(nil), // 1: cloudevent.CloudEventHeader + nil, // 2: cloudevent.CloudEventHeader.ExtrasEntry + (*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp +} +var file_pkg_grpc_cloudevent_proto_depIdxs = []int32{ + 1, // 0: cloudevent.CloudEvent.header:type_name -> cloudevent.CloudEventHeader + 3, // 1: cloudevent.CloudEventHeader.time:type_name -> google.protobuf.Timestamp + 2, // 2: cloudevent.CloudEventHeader.extras:type_name -> cloudevent.CloudEventHeader.ExtrasEntry + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_pkg_grpc_cloudevent_proto_init() } +func file_pkg_grpc_cloudevent_proto_init() { + if File_pkg_grpc_cloudevent_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pkg_grpc_cloudevent_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*CloudEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_grpc_cloudevent_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*CloudEventHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkg_grpc_cloudevent_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pkg_grpc_cloudevent_proto_goTypes, + DependencyIndexes: file_pkg_grpc_cloudevent_proto_depIdxs, + MessageInfos: file_pkg_grpc_cloudevent_proto_msgTypes, + }.Build() + File_pkg_grpc_cloudevent_proto = out.File + file_pkg_grpc_cloudevent_proto_rawDesc = nil + file_pkg_grpc_cloudevent_proto_goTypes = nil + file_pkg_grpc_cloudevent_proto_depIdxs = nil +} diff --git a/pkg/grpc/cloudevent.proto b/pkg/grpc/cloudevent.proto new file mode 100644 index 0000000..7379834 --- /dev/null +++ b/pkg/grpc/cloudevent.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; + +package cloudevent; + +option go_package = "github.com/DIMO-Network/fetch-api/pkg/grpc"; + +import "google/protobuf/timestamp.proto"; + +// CloudEvent represents a CloudEvent with a header and data. +message CloudEvent { + CloudEventHeader header = 1; + bytes data = 2; + } + +// CloudEventHeader represents the header structure of a CloudEvent. +message CloudEventHeader { + // ID is an identifier for the event. The combination of ID and Source must + // be unique. + string id = 1; + + // Source is the context in which the event happened. In a distributed system it might consist of multiple Producers. + // Typically the 0x address. + string source = 2; + + // Producer is a specific instance, process or device that creates the data structure describing the CloudEvent. + // Typically a DID of a nft. + string producer = 3; + + // SpecVersion is the version of CloudEvents specification used. + // This is always hardcoded "1.0". + string spec_version = 4; + + // Subject is an optional field identifying the subject of the event within + // the context of the event producer. + // Typically the DID of the nft. + string subject = 5; + + // Time which the event occurred. + google.protobuf.Timestamp time = 6; + + // Type describes the type of event. + // Typically a one of the predefined DIMO types. (dimo.status, dimo.fingerprint, dimo.verfiabaleCredential...) + string type = 7; + + // DataContentType is an optional MIME type for the data field. We almost + // always serialize to JSON and in that case this field is implicitly + // "application/json". + string data_content_type = 8; + + // DataSchema is an optional URI pointing to a schema for the data field. + string data_schema = 9; + + // DataVersion is the controlled by the source of the event and is used to provide information about the data. + string data_version = 10; + + // Extras contains any additional fields that are not part of the CloudEvent excluding the data field. + map extras = 11; +} + diff --git a/pkg/grpc/common.go b/pkg/grpc/common.go new file mode 100644 index 0000000..dfb4ff0 --- /dev/null +++ b/pkg/grpc/common.go @@ -0,0 +1,40 @@ +package grpc + +import ( + "encoding/json" + + "github.com/DIMO-Network/model-garage/pkg/cloudevent" +) + +// AsCloudEvent converts the CloudEvent to a cloudevent.CloudEvent[json.RawMessage]. +func (c *CloudEvent) AsCloudEvent() cloudevent.CloudEvent[json.RawMessage] { + return cloudevent.CloudEvent[json.RawMessage]{ + CloudEventHeader: c.GetHeader().AsCloudEventHeader(), + Data: c.GetData(), + } +} + +// AsCloudEventHeader converts the CloudEventHeader to a cloudevent.CloudEventHeader. +func (c *CloudEventHeader) AsCloudEventHeader() cloudevent.CloudEventHeader { + extras := make(map[string]any, len(c.GetExtras())) + for k, v := range c.GetExtras() { + var val any + if err := json.Unmarshal(v, &val); err != nil { + val = v + } + extras[k] = val + } + return cloudevent.CloudEventHeader{ + ID: c.GetId(), + Source: c.GetSource(), + Producer: c.GetProducer(), + SpecVersion: c.GetSpecVersion(), + Subject: c.GetSubject(), + Time: c.GetTime().AsTime(), + Type: c.GetType(), + DataContentType: c.GetDataContentType(), + DataSchema: c.GetDataSchema(), + DataVersion: c.GetDataVersion(), + Extras: extras, + } +} diff --git a/pkg/grpc/fetch-api.pb.go b/pkg/grpc/fetch-api.pb.go index f371055..dd52393 100644 --- a/pkg/grpc/fetch-api.pb.go +++ b/pkg/grpc/fetch-api.pb.go @@ -153,64 +153,6 @@ func (x *SearchOptions) GetOptional() *wrapperspb.StringValue { return nil } -// DataObject contains the index key and data retrieved from the object. -type DataObject struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The index key of the object. - IndexKey string `protobuf:"bytes,1,opt,name=index_key,json=indexKey,proto3" json:"index_key,omitempty"` - // The data retrieved from the object. - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` -} - -func (x *DataObject) Reset() { - *x = DataObject{} - if protoimpl.UnsafeEnabled { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DataObject) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DataObject) ProtoMessage() {} - -func (x *DataObject) ProtoReflect() protoreflect.Message { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DataObject.ProtoReflect.Descriptor instead. -func (*DataObject) Descriptor() ([]byte, []int) { - return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{1} -} - -func (x *DataObject) GetIndexKey() string { - if x != nil { - return x.IndexKey - } - return "" -} - -func (x *DataObject) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - // GetLatestIndexKeyRequest includes search options to filter the events. type GetLatestIndexKeyRequest struct { state protoimpl.MessageState @@ -223,7 +165,7 @@ type GetLatestIndexKeyRequest struct { func (x *GetLatestIndexKeyRequest) Reset() { *x = GetLatestIndexKeyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[2] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -236,7 +178,7 @@ func (x *GetLatestIndexKeyRequest) String() string { func (*GetLatestIndexKeyRequest) ProtoMessage() {} func (x *GetLatestIndexKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[2] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -249,7 +191,7 @@ func (x *GetLatestIndexKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetLatestIndexKeyRequest.ProtoReflect.Descriptor instead. func (*GetLatestIndexKeyRequest) Descriptor() ([]byte, []int) { - return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{2} + return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{1} } func (x *GetLatestIndexKeyRequest) GetOptions() *SearchOptions { @@ -272,7 +214,7 @@ type GetLatestIndexKeyResponse struct { func (x *GetLatestIndexKeyResponse) Reset() { *x = GetLatestIndexKeyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[3] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -285,7 +227,7 @@ func (x *GetLatestIndexKeyResponse) String() string { func (*GetLatestIndexKeyResponse) ProtoMessage() {} func (x *GetLatestIndexKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[3] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -298,7 +240,7 @@ func (x *GetLatestIndexKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetLatestIndexKeyResponse.ProtoReflect.Descriptor instead. func (*GetLatestIndexKeyResponse) Descriptor() ([]byte, []int) { - return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{3} + return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{2} } func (x *GetLatestIndexKeyResponse) GetIndexKey() string { @@ -323,7 +265,7 @@ type GetIndexKeysRequest struct { func (x *GetIndexKeysRequest) Reset() { *x = GetIndexKeysRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[4] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -336,7 +278,7 @@ func (x *GetIndexKeysRequest) String() string { func (*GetIndexKeysRequest) ProtoMessage() {} func (x *GetIndexKeysRequest) ProtoReflect() protoreflect.Message { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[4] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -349,7 +291,7 @@ func (x *GetIndexKeysRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetIndexKeysRequest.ProtoReflect.Descriptor instead. func (*GetIndexKeysRequest) Descriptor() ([]byte, []int) { - return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{4} + return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{3} } func (x *GetIndexKeysRequest) GetOptions() *SearchOptions { @@ -379,7 +321,7 @@ type GetIndexKeysResponse struct { func (x *GetIndexKeysResponse) Reset() { *x = GetIndexKeysResponse{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[5] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -392,7 +334,7 @@ func (x *GetIndexKeysResponse) String() string { func (*GetIndexKeysResponse) ProtoMessage() {} func (x *GetIndexKeysResponse) ProtoReflect() protoreflect.Message { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[5] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -405,7 +347,7 @@ func (x *GetIndexKeysResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetIndexKeysResponse.ProtoReflect.Descriptor instead. func (*GetIndexKeysResponse) Descriptor() ([]byte, []int) { - return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{5} + return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{4} } func (x *GetIndexKeysResponse) GetIndexKeys() []string { @@ -428,7 +370,7 @@ type GetLatestObjectRequest struct { func (x *GetLatestObjectRequest) Reset() { *x = GetLatestObjectRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[6] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -441,7 +383,7 @@ func (x *GetLatestObjectRequest) String() string { func (*GetLatestObjectRequest) ProtoMessage() {} func (x *GetLatestObjectRequest) ProtoReflect() protoreflect.Message { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[6] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -454,7 +396,7 @@ func (x *GetLatestObjectRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetLatestObjectRequest.ProtoReflect.Descriptor instead. func (*GetLatestObjectRequest) Descriptor() ([]byte, []int) { - return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{6} + return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{5} } func (x *GetLatestObjectRequest) GetOptions() *SearchOptions { @@ -471,13 +413,13 @@ type GetLatestObjectResponse struct { unknownFields protoimpl.UnknownFields // The data retrieved from the latest cloud event. - DataObject *DataObject `protobuf:"bytes,1,opt,name=data_object,json=dataObject,proto3" json:"data_object,omitempty"` + DataObject *CloudEvent `protobuf:"bytes,1,opt,name=data_object,json=dataObject,proto3" json:"data_object,omitempty"` } func (x *GetLatestObjectResponse) Reset() { *x = GetLatestObjectResponse{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[7] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -490,7 +432,7 @@ func (x *GetLatestObjectResponse) String() string { func (*GetLatestObjectResponse) ProtoMessage() {} func (x *GetLatestObjectResponse) ProtoReflect() protoreflect.Message { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[7] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -503,10 +445,10 @@ func (x *GetLatestObjectResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetLatestObjectResponse.ProtoReflect.Descriptor instead. func (*GetLatestObjectResponse) Descriptor() ([]byte, []int) { - return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{7} + return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{6} } -func (x *GetLatestObjectResponse) GetDataObject() *DataObject { +func (x *GetLatestObjectResponse) GetDataObject() *CloudEvent { if x != nil { return x.DataObject } @@ -528,7 +470,7 @@ type GetObjectsRequest struct { func (x *GetObjectsRequest) Reset() { *x = GetObjectsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[8] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -541,7 +483,7 @@ func (x *GetObjectsRequest) String() string { func (*GetObjectsRequest) ProtoMessage() {} func (x *GetObjectsRequest) ProtoReflect() protoreflect.Message { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[8] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -554,7 +496,7 @@ func (x *GetObjectsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObjectsRequest.ProtoReflect.Descriptor instead. func (*GetObjectsRequest) Descriptor() ([]byte, []int) { - return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{8} + return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{7} } func (x *GetObjectsRequest) GetOptions() *SearchOptions { @@ -578,13 +520,13 @@ type GetObjectsResponse struct { unknownFields protoimpl.UnknownFields // The list of data retrieved from the objects. - DataObjects []*DataObject `protobuf:"bytes,1,rep,name=data_objects,json=dataObjects,proto3" json:"data_objects,omitempty"` + CloudEvents []*CloudEvent `protobuf:"bytes,1,rep,name=cloud_events,json=cloudEvents,proto3" json:"cloud_events,omitempty"` } func (x *GetObjectsResponse) Reset() { *x = GetObjectsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[9] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -597,7 +539,7 @@ func (x *GetObjectsResponse) String() string { func (*GetObjectsResponse) ProtoMessage() {} func (x *GetObjectsResponse) ProtoReflect() protoreflect.Message { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[9] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -610,12 +552,12 @@ func (x *GetObjectsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObjectsResponse.ProtoReflect.Descriptor instead. func (*GetObjectsResponse) Descriptor() ([]byte, []int) { - return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{9} + return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{8} } -func (x *GetObjectsResponse) GetDataObjects() []*DataObject { +func (x *GetObjectsResponse) GetCloudEvents() []*CloudEvent { if x != nil { - return x.DataObjects + return x.CloudEvents } return nil } @@ -633,7 +575,7 @@ type GetObjectsFromIndexKeysRequest struct { func (x *GetObjectsFromIndexKeysRequest) Reset() { *x = GetObjectsFromIndexKeysRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[10] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -646,7 +588,7 @@ func (x *GetObjectsFromIndexKeysRequest) String() string { func (*GetObjectsFromIndexKeysRequest) ProtoMessage() {} func (x *GetObjectsFromIndexKeysRequest) ProtoReflect() protoreflect.Message { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[10] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -659,7 +601,7 @@ func (x *GetObjectsFromIndexKeysRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObjectsFromIndexKeysRequest.ProtoReflect.Descriptor instead. func (*GetObjectsFromIndexKeysRequest) Descriptor() ([]byte, []int) { - return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{10} + return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{9} } func (x *GetObjectsFromIndexKeysRequest) GetIndexKeys() []string { @@ -676,13 +618,13 @@ type GetObjectsFromIndexKeysResponse struct { unknownFields protoimpl.UnknownFields // The list of data retrieved from the objects. - DataObjects []*DataObject `protobuf:"bytes,1,rep,name=data_objects,json=dataObjects,proto3" json:"data_objects,omitempty"` + CloudEvents []*CloudEvent `protobuf:"bytes,1,rep,name=cloud_events,json=cloudEvents,proto3" json:"cloud_events,omitempty"` } func (x *GetObjectsFromIndexKeysResponse) Reset() { *x = GetObjectsFromIndexKeysResponse{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[11] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -695,7 +637,7 @@ func (x *GetObjectsFromIndexKeysResponse) String() string { func (*GetObjectsFromIndexKeysResponse) ProtoMessage() {} func (x *GetObjectsFromIndexKeysResponse) ProtoReflect() protoreflect.Message { - mi := &file_pkg_grpc_fetch_api_proto_msgTypes[11] + mi := &file_pkg_grpc_fetch_api_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -708,12 +650,12 @@ func (x *GetObjectsFromIndexKeysResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObjectsFromIndexKeysResponse.ProtoReflect.Descriptor instead. func (*GetObjectsFromIndexKeysResponse) Descriptor() ([]byte, []int) { - return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{11} + return file_pkg_grpc_fetch_api_proto_rawDescGZIP(), []int{10} } -func (x *GetObjectsFromIndexKeysResponse) GetDataObjects() []*DataObject { +func (x *GetObjectsFromIndexKeysResponse) GetCloudEvents() []*CloudEvent { if x != nil { - return x.DataObjects + return x.CloudEvents } return nil } @@ -727,126 +669,124 @@ var file_pkg_grpc_fetch_api_proto_rawDesc = []byte{ 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xe1, 0x04, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, - 0x61, 0x66, 0x74, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x06, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x06, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x12, 0x3f, 0x0a, 0x0d, 0x74, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x61, 0x73, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x6f, 0x1a, 0x19, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x6c, 0x6f, 0x75, + 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe1, 0x04, 0x0a, + 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, + 0x0a, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, + 0x12, 0x32, 0x0a, 0x06, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x41, 0x73, 0x63, 0x12, 0x43, 0x0a, 0x0e, 0x70, 0x72, - 0x69, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x0d, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x6c, 0x65, 0x72, 0x12, - 0x39, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x12, 0x47, 0x0a, 0x10, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x5f, - 0x66, 0x69, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x73, 0x65, 0x63, 0x6f, - 0x6e, 0x64, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x06, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x12, 0x38, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x12, 0x38, 0x0a, 0x08, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x06, 0x62, 0x65, + 0x66, 0x6f, 0x72, 0x65, 0x12, 0x3f, 0x0a, 0x0d, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x5f, 0x61, 0x73, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, + 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x41, 0x73, 0x63, 0x12, 0x43, 0x0a, 0x0e, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, + 0x5f, 0x66, 0x69, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0x3d, 0x0a, 0x0a, 0x44, 0x61, 0x74, 0x61, 0x4f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, - 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x22, 0x49, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, - 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, - 0x38, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, - 0x78, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x22, 0x5a, 0x0a, 0x13, 0x47, 0x65, 0x74, - 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x35, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x64, 0x65, - 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, - 0x0a, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x09, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x47, 0x0a, 0x16, - 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, - 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x4c, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, - 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x31, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x61, 0x74, - 0x61, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x4f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x22, 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x49, 0x0a, - 0x12, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x0c, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x44, 0x61, 0x74, 0x61, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x0b, 0x64, 0x61, 0x74, - 0x61, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x3f, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x46, 0x72, 0x6f, 0x6d, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, - 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x56, 0x0a, 0x1f, 0x47, 0x65, 0x74, - 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x46, 0x72, 0x6f, 0x6d, 0x49, 0x6e, 0x64, 0x65, 0x78, - 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x0c, - 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x52, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x73, 0x32, 0xa4, 0x03, 0x0a, 0x0c, 0x46, 0x65, 0x74, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x54, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, - 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, - 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0d, 0x70, 0x72, 0x69, + 0x6d, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x39, 0x0a, 0x09, 0x64, 0x61, + 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x64, 0x61, 0x74, + 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x47, 0x0a, + 0x10, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x6c, 0x65, + 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, + 0x46, 0x69, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x38, 0x0a, 0x08, + 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x70, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x12, 0x38, 0x0a, 0x08, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x61, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x22, 0x49, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x38, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x49, - 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, - 0x47, 0x65, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, - 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x4e, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x12, 0x1c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, - 0x65, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, - 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x3f, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x17, 0x2e, - 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, - 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x66, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x46, 0x72, - 0x6f, 0x6d, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x24, 0x2e, 0x67, 0x72, - 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x46, 0x72, 0x6f, - 0x6d, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x25, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x73, 0x46, 0x72, 0x6f, 0x6d, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x44, 0x49, 0x4d, 0x4f, 0x2d, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2d, 0x67, 0x61, 0x72, 0x61, 0x67, 0x65, - 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x4b, 0x65, 0x79, 0x22, 0x5a, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x64, 0x65, + 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, + 0x74, 0x22, 0x35, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x47, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4c, + 0x61, 0x74, 0x65, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x22, 0x52, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0b, + 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x43, + 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, + 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, + 0x4f, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x0c, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6c, + 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x52, 0x0b, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, + 0x22, 0x3f, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x46, 0x72, + 0x6f, 0x6d, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6b, 0x65, 0x79, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, + 0x73, 0x22, 0x5c, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x46, + 0x72, 0x6f, 0x6d, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x0c, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x52, 0x0b, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x32, + 0xa4, 0x03, 0x0a, 0x0c, 0x46, 0x65, 0x74, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x54, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, + 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, + 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, + 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x64, 0x65, + 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4e, 0x0a, + 0x0f, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x12, 0x1c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, + 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, + 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, + 0x0a, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x17, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, + 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x46, 0x72, 0x6f, 0x6d, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x24, 0x2e, 0x67, 0x72, 0x70, 0x63, + 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x46, 0x72, 0x6f, 0x6d, 0x49, + 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x25, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x73, 0x46, 0x72, 0x6f, 0x6d, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x44, 0x49, 0x4d, 0x4f, 0x2d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2f, 0x66, 0x65, 0x74, 0x63, 0x68, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -861,52 +801,52 @@ func file_pkg_grpc_fetch_api_proto_rawDescGZIP() []byte { return file_pkg_grpc_fetch_api_proto_rawDescData } -var file_pkg_grpc_fetch_api_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_pkg_grpc_fetch_api_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_pkg_grpc_fetch_api_proto_goTypes = []any{ (*SearchOptions)(nil), // 0: grpc.SearchOptions - (*DataObject)(nil), // 1: grpc.DataObject - (*GetLatestIndexKeyRequest)(nil), // 2: grpc.GetLatestIndexKeyRequest - (*GetLatestIndexKeyResponse)(nil), // 3: grpc.GetLatestIndexKeyResponse - (*GetIndexKeysRequest)(nil), // 4: grpc.GetIndexKeysRequest - (*GetIndexKeysResponse)(nil), // 5: grpc.GetIndexKeysResponse - (*GetLatestObjectRequest)(nil), // 6: grpc.GetLatestObjectRequest - (*GetLatestObjectResponse)(nil), // 7: grpc.GetLatestObjectResponse - (*GetObjectsRequest)(nil), // 8: grpc.GetObjectsRequest - (*GetObjectsResponse)(nil), // 9: grpc.GetObjectsResponse - (*GetObjectsFromIndexKeysRequest)(nil), // 10: grpc.GetObjectsFromIndexKeysRequest - (*GetObjectsFromIndexKeysResponse)(nil), // 11: grpc.GetObjectsFromIndexKeysResponse - (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp - (*wrapperspb.BoolValue)(nil), // 13: google.protobuf.BoolValue - (*wrapperspb.StringValue)(nil), // 14: google.protobuf.StringValue + (*GetLatestIndexKeyRequest)(nil), // 1: grpc.GetLatestIndexKeyRequest + (*GetLatestIndexKeyResponse)(nil), // 2: grpc.GetLatestIndexKeyResponse + (*GetIndexKeysRequest)(nil), // 3: grpc.GetIndexKeysRequest + (*GetIndexKeysResponse)(nil), // 4: grpc.GetIndexKeysResponse + (*GetLatestObjectRequest)(nil), // 5: grpc.GetLatestObjectRequest + (*GetLatestObjectResponse)(nil), // 6: grpc.GetLatestObjectResponse + (*GetObjectsRequest)(nil), // 7: grpc.GetObjectsRequest + (*GetObjectsResponse)(nil), // 8: grpc.GetObjectsResponse + (*GetObjectsFromIndexKeysRequest)(nil), // 9: grpc.GetObjectsFromIndexKeysRequest + (*GetObjectsFromIndexKeysResponse)(nil), // 10: grpc.GetObjectsFromIndexKeysResponse + (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp + (*wrapperspb.BoolValue)(nil), // 12: google.protobuf.BoolValue + (*wrapperspb.StringValue)(nil), // 13: google.protobuf.StringValue + (*CloudEvent)(nil), // 14: cloudevent.CloudEvent } var file_pkg_grpc_fetch_api_proto_depIdxs = []int32{ - 12, // 0: grpc.SearchOptions.after:type_name -> google.protobuf.Timestamp - 12, // 1: grpc.SearchOptions.before:type_name -> google.protobuf.Timestamp - 13, // 2: grpc.SearchOptions.timestamp_asc:type_name -> google.protobuf.BoolValue - 14, // 3: grpc.SearchOptions.primary_filler:type_name -> google.protobuf.StringValue - 14, // 4: grpc.SearchOptions.data_type:type_name -> google.protobuf.StringValue - 14, // 5: grpc.SearchOptions.subject:type_name -> google.protobuf.StringValue - 14, // 6: grpc.SearchOptions.secondary_filler:type_name -> google.protobuf.StringValue - 14, // 7: grpc.SearchOptions.source:type_name -> google.protobuf.StringValue - 14, // 8: grpc.SearchOptions.producer:type_name -> google.protobuf.StringValue - 14, // 9: grpc.SearchOptions.optional:type_name -> google.protobuf.StringValue + 11, // 0: grpc.SearchOptions.after:type_name -> google.protobuf.Timestamp + 11, // 1: grpc.SearchOptions.before:type_name -> google.protobuf.Timestamp + 12, // 2: grpc.SearchOptions.timestamp_asc:type_name -> google.protobuf.BoolValue + 13, // 3: grpc.SearchOptions.primary_filler:type_name -> google.protobuf.StringValue + 13, // 4: grpc.SearchOptions.data_type:type_name -> google.protobuf.StringValue + 13, // 5: grpc.SearchOptions.subject:type_name -> google.protobuf.StringValue + 13, // 6: grpc.SearchOptions.secondary_filler:type_name -> google.protobuf.StringValue + 13, // 7: grpc.SearchOptions.source:type_name -> google.protobuf.StringValue + 13, // 8: grpc.SearchOptions.producer:type_name -> google.protobuf.StringValue + 13, // 9: grpc.SearchOptions.optional:type_name -> google.protobuf.StringValue 0, // 10: grpc.GetLatestIndexKeyRequest.options:type_name -> grpc.SearchOptions 0, // 11: grpc.GetIndexKeysRequest.options:type_name -> grpc.SearchOptions 0, // 12: grpc.GetLatestObjectRequest.options:type_name -> grpc.SearchOptions - 1, // 13: grpc.GetLatestObjectResponse.data_object:type_name -> grpc.DataObject + 14, // 13: grpc.GetLatestObjectResponse.data_object:type_name -> cloudevent.CloudEvent 0, // 14: grpc.GetObjectsRequest.options:type_name -> grpc.SearchOptions - 1, // 15: grpc.GetObjectsResponse.data_objects:type_name -> grpc.DataObject - 1, // 16: grpc.GetObjectsFromIndexKeysResponse.data_objects:type_name -> grpc.DataObject - 2, // 17: grpc.FetchService.GetLatestIndexKey:input_type -> grpc.GetLatestIndexKeyRequest - 4, // 18: grpc.FetchService.GetIndexKeys:input_type -> grpc.GetIndexKeysRequest - 6, // 19: grpc.FetchService.GetLatestObject:input_type -> grpc.GetLatestObjectRequest - 8, // 20: grpc.FetchService.GetObjects:input_type -> grpc.GetObjectsRequest - 10, // 21: grpc.FetchService.GetObjectsFromIndexKeys:input_type -> grpc.GetObjectsFromIndexKeysRequest - 3, // 22: grpc.FetchService.GetLatestIndexKey:output_type -> grpc.GetLatestIndexKeyResponse - 5, // 23: grpc.FetchService.GetIndexKeys:output_type -> grpc.GetIndexKeysResponse - 7, // 24: grpc.FetchService.GetLatestObject:output_type -> grpc.GetLatestObjectResponse - 9, // 25: grpc.FetchService.GetObjects:output_type -> grpc.GetObjectsResponse - 11, // 26: grpc.FetchService.GetObjectsFromIndexKeys:output_type -> grpc.GetObjectsFromIndexKeysResponse + 14, // 15: grpc.GetObjectsResponse.cloud_events:type_name -> cloudevent.CloudEvent + 14, // 16: grpc.GetObjectsFromIndexKeysResponse.cloud_events:type_name -> cloudevent.CloudEvent + 1, // 17: grpc.FetchService.GetLatestIndexKey:input_type -> grpc.GetLatestIndexKeyRequest + 3, // 18: grpc.FetchService.GetIndexKeys:input_type -> grpc.GetIndexKeysRequest + 5, // 19: grpc.FetchService.GetLatestObject:input_type -> grpc.GetLatestObjectRequest + 7, // 20: grpc.FetchService.GetObjects:input_type -> grpc.GetObjectsRequest + 9, // 21: grpc.FetchService.GetObjectsFromIndexKeys:input_type -> grpc.GetObjectsFromIndexKeysRequest + 2, // 22: grpc.FetchService.GetLatestIndexKey:output_type -> grpc.GetLatestIndexKeyResponse + 4, // 23: grpc.FetchService.GetIndexKeys:output_type -> grpc.GetIndexKeysResponse + 6, // 24: grpc.FetchService.GetLatestObject:output_type -> grpc.GetLatestObjectResponse + 8, // 25: grpc.FetchService.GetObjects:output_type -> grpc.GetObjectsResponse + 10, // 26: grpc.FetchService.GetObjectsFromIndexKeys:output_type -> grpc.GetObjectsFromIndexKeysResponse 22, // [22:27] is the sub-list for method output_type 17, // [17:22] is the sub-list for method input_type 17, // [17:17] is the sub-list for extension type_name @@ -919,6 +859,7 @@ func file_pkg_grpc_fetch_api_proto_init() { if File_pkg_grpc_fetch_api_proto != nil { return } + file_pkg_grpc_cloudevent_proto_init() if !protoimpl.UnsafeEnabled { file_pkg_grpc_fetch_api_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*SearchOptions); i { @@ -933,18 +874,6 @@ func file_pkg_grpc_fetch_api_proto_init() { } } file_pkg_grpc_fetch_api_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*DataObject); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pkg_grpc_fetch_api_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*GetLatestIndexKeyRequest); i { case 0: return &v.state @@ -956,7 +885,7 @@ func file_pkg_grpc_fetch_api_proto_init() { return nil } } - file_pkg_grpc_fetch_api_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_pkg_grpc_fetch_api_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*GetLatestIndexKeyResponse); i { case 0: return &v.state @@ -968,7 +897,7 @@ func file_pkg_grpc_fetch_api_proto_init() { return nil } } - file_pkg_grpc_fetch_api_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_pkg_grpc_fetch_api_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*GetIndexKeysRequest); i { case 0: return &v.state @@ -980,7 +909,7 @@ func file_pkg_grpc_fetch_api_proto_init() { return nil } } - file_pkg_grpc_fetch_api_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_pkg_grpc_fetch_api_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*GetIndexKeysResponse); i { case 0: return &v.state @@ -992,7 +921,7 @@ func file_pkg_grpc_fetch_api_proto_init() { return nil } } - file_pkg_grpc_fetch_api_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_pkg_grpc_fetch_api_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*GetLatestObjectRequest); i { case 0: return &v.state @@ -1004,7 +933,7 @@ func file_pkg_grpc_fetch_api_proto_init() { return nil } } - file_pkg_grpc_fetch_api_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_pkg_grpc_fetch_api_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*GetLatestObjectResponse); i { case 0: return &v.state @@ -1016,7 +945,7 @@ func file_pkg_grpc_fetch_api_proto_init() { return nil } } - file_pkg_grpc_fetch_api_proto_msgTypes[8].Exporter = func(v any, i int) any { + file_pkg_grpc_fetch_api_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*GetObjectsRequest); i { case 0: return &v.state @@ -1028,7 +957,7 @@ func file_pkg_grpc_fetch_api_proto_init() { return nil } } - file_pkg_grpc_fetch_api_proto_msgTypes[9].Exporter = func(v any, i int) any { + file_pkg_grpc_fetch_api_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*GetObjectsResponse); i { case 0: return &v.state @@ -1040,7 +969,7 @@ func file_pkg_grpc_fetch_api_proto_init() { return nil } } - file_pkg_grpc_fetch_api_proto_msgTypes[10].Exporter = func(v any, i int) any { + file_pkg_grpc_fetch_api_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*GetObjectsFromIndexKeysRequest); i { case 0: return &v.state @@ -1052,7 +981,7 @@ func file_pkg_grpc_fetch_api_proto_init() { return nil } } - file_pkg_grpc_fetch_api_proto_msgTypes[11].Exporter = func(v any, i int) any { + file_pkg_grpc_fetch_api_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*GetObjectsFromIndexKeysResponse); i { case 0: return &v.state @@ -1071,7 +1000,7 @@ func file_pkg_grpc_fetch_api_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pkg_grpc_fetch_api_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 11, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/grpc/fetch-api.proto b/pkg/grpc/fetch-api.proto index 0feaca1..c1a427e 100644 --- a/pkg/grpc/fetch-api.proto +++ b/pkg/grpc/fetch-api.proto @@ -1,11 +1,12 @@ syntax = "proto3"; -option go_package = "github.com/DIMO-Network/model-garage/pkg/grpc"; +option go_package = "github.com/DIMO-Network/fetch-api/pkg/grpc"; package grpc; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; +import "pkg/grpc/cloudevent.proto"; // FetchService defines the gRPC service for fetching DIMO objects service FetchService { @@ -59,13 +60,6 @@ message SearchOptions { google.protobuf.StringValue optional = 10; } -// DataObject contains the index key and data retrieved from the object. -message DataObject { - // The index key of the object. - string index_key = 1; - // The data retrieved from the object. - bytes data = 2; -} // GetLatestIndexKeyRequest includes search options to filter the events. message GetLatestIndexKeyRequest { @@ -102,7 +96,7 @@ message GetLatestObjectRequest { // GetLatestObjectResponse provides the data retrieved from the latest cloud event. message GetLatestObjectResponse { // The data retrieved from the latest cloud event. - DataObject data_object = 1; + cloudevent.CloudEvent data_object = 1; } // GetObjectsRequest includes search options to filter the events. @@ -117,7 +111,7 @@ message GetObjectsRequest { // GetObjectsResponse provides the list of data retrieved from the objects. message GetObjectsResponse { // The list of data retrieved from the objects. - repeated DataObject data_objects = 1; + repeated cloudevent.CloudEvent cloud_events = 1; } // GetObjectsFromIndexKeysRequest includes the index key to filter the events. @@ -129,5 +123,5 @@ message GetObjectsFromIndexKeysRequest { // GetObjectsFromNameResponse provides the list of data retrieved from the objects. message GetObjectsFromIndexKeysResponse { // The list of data retrieved from the objects. - repeated DataObject data_objects = 1; + repeated cloudevent.CloudEvent cloud_events = 1; } \ No newline at end of file