From bb93328f8289286eb47f35610d415fc504e2320f Mon Sep 17 00:00:00 2001 From: Kleonikos Kyriakis Date: Tue, 27 Feb 2024 11:56:59 +0200 Subject: [PATCH] [Metadata] Add temp support for grpc metadata header provider_operator (#8) --- internal/metadata/metadata.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/metadata/metadata.go b/internal/metadata/metadata.go index b0879e40..3312b93e 100644 --- a/internal/metadata/metadata.go +++ b/internal/metadata/metadata.go @@ -18,6 +18,9 @@ type Metadata struct { Timestamps map[string]int64 `json:"timestamps"` // map of checkpoints to timestamps in unix milliseconds NumberOfChunks uint `json:"number_of_chunks"` ChunkIndex uint `json:"chunk_index"` + + // Deprecated: this metadata serves only as a temp solution and should be removed and addressed on the protocol level + ProviderOperator string `json:"provider_operator"` } func (m *Metadata) ExtractMetadata(ctx context.Context) error { @@ -58,6 +61,9 @@ func (m *Metadata) FromGrpcMD(mdPairs metadata.MD) error { return fmt.Errorf("error unmarshalling timestamps: %v", err) } } + if providerOperator, found := mdPairs["provider_operator"]; found { + m.ProviderOperator = providerOperator[0] + } return nil } func (m *Metadata) ToGrpcMD() metadata.MD { @@ -73,6 +79,7 @@ func (m *Metadata) ToGrpcMD() metadata.MD { chequesJSON, _ := json.Marshal(m.Cheques) return string(chequesJSON) }(), + "provider_operator": m.ProviderOperator, }) return md }