From 89dd5dada286c5c72f3b6c43cc2e76714319d8ae Mon Sep 17 00:00:00 2001 From: Sergey Cherepanov Date: Mon, 6 Mar 2023 12:22:29 +0300 Subject: [PATCH] fileId ctx funcs --- commonfile/fileblockstore/fileblockstore.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/commonfile/fileblockstore/fileblockstore.go b/commonfile/fileblockstore/fileblockstore.go index 3f2e33af..99c89b20 100644 --- a/commonfile/fileblockstore/fileblockstore.go +++ b/commonfile/fileblockstore/fileblockstore.go @@ -21,6 +21,7 @@ type ctxKey uint const ( ctxKeySpaceId ctxKey = iota + ctxKeyFileId ) type BlockStore interface { @@ -48,3 +49,12 @@ func CtxGetSpaceId(ctx context.Context) (spaceId string) { spaceId, _ = ctx.Value(ctxKeySpaceId).(string) return } + +func CtxWithFileId(ctx context.Context, spaceId string) context.Context { + return context.WithValue(ctx, ctxKeyFileId, spaceId) +} + +func CtxGetFileId(ctx context.Context) (spaceId string) { + spaceId, _ = ctx.Value(ctxKeyFileId).(string) + return +}