Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'internal/helper/storage.go')
-rw-r--r--internal/helper/storage.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/helper/storage.go b/internal/helper/storage.go
index 4e535a5d6..f3f0d0ba0 100644
--- a/internal/helper/storage.go
+++ b/internal/helper/storage.go
@@ -34,6 +34,17 @@ func ExtractGitalyServers(ctx context.Context) (gitalyServersInfo storage.Gitaly
return
}
+// IncomingToOutgoing creates an outgoing context out of an incoming context with the same storage metadata
+func IncomingToOutgoing(ctx context.Context) context.Context {
+ md, ok := metadata.FromIncomingContext(ctx)
+ if !ok {
+ return ctx
+ }
+
+ return metadata.NewOutgoingContext(ctx, md)
+
+}
+
// InjectGitalyServers injects gitaly-servers metadata into an outgoing context
func InjectGitalyServers(ctx context.Context, name, address, token string) (context.Context, error) {