Skip to content

Commit 3162fb5

Browse files
authored
Merge pull request #51 from yue9944882/feat/parent-storage-getter
Feat: Support retrieving get-only storage storage
2 parents 8433bb8 + 428d0c2 commit 3162fb5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/util/context/context.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,13 @@ func GetParentStorage(ctx context.Context) (rest.StandardStorage, bool) {
2323
}
2424
return parentStorage.(rest.StandardStorage), true
2525
}
26+
27+
// GetParentStorageGetter tries getting the get-only parent storage from
28+
// context.
29+
func GetParentStorageGetter(ctx context.Context) (rest.Getter, bool) {
30+
parentStorage := ctx.Value(parentStorageContextKey)
31+
if parentStorage == nil {
32+
return nil, false
33+
}
34+
return parentStorage.(rest.Getter), true
35+
}

0 commit comments

Comments
 (0)