Skip to content

Commit

Permalink
[Metadata] Add temp support for grpc metadata header provider_operator (
Browse files Browse the repository at this point in the history
  • Loading branch information
knikos authored Feb 27, 2024
1 parent f5a603a commit bb93328
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -73,6 +79,7 @@ func (m *Metadata) ToGrpcMD() metadata.MD {
chequesJSON, _ := json.Marshal(m.Cheques)
return string(chequesJSON)
}(),
"provider_operator": m.ProviderOperator,
})
return md
}
Expand Down

0 comments on commit bb93328

Please sign in to comment.