fileId ctx funcs

This commit is contained in:
Sergey Cherepanov 2023-03-06 12:22:29 +03:00 committed by Mikhail Iudin
parent 3dc92b9a67
commit 89dd5dada2
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0

View File

@ -21,6 +21,7 @@ type ctxKey uint
const ( const (
ctxKeySpaceId ctxKey = iota ctxKeySpaceId ctxKey = iota
ctxKeyFileId
) )
type BlockStore interface { type BlockStore interface {
@ -48,3 +49,12 @@ func CtxGetSpaceId(ctx context.Context) (spaceId string) {
spaceId, _ = ctx.Value(ctxKeySpaceId).(string) spaceId, _ = ctx.Value(ctxKeySpaceId).(string)
return 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
}