fileId ctx funcs

This commit is contained in:
Sergey Cherepanov 2023-03-06 12:22:29 +03:00
parent a497e129c4
commit bee7146a60
No known key found for this signature in database
GPG Key ID: 87F8EDE8FBDF637C

View File

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