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 +}