@@ -26,28 +26,36 @@ var (
2626 componentDigestContextKey = componentDigestContextKeyType {}
2727)
2828
29- func newContext (ctx context.Context ) * reconcileContext {
30- return & reconcileContext {Context : ctx }
29+ type Context interface {
30+ context.Context
31+ WithReconcilerName (reconcilerName string ) Context
32+ WithClient (clnt cluster.Client ) Context
33+ WithComponent (component Component ) Context
34+ WithComponentDigest (componentDigest string ) Context
35+ }
36+
37+ func NewContext (ctx context.Context ) Context {
38+ return & contextImpl {Context : ctx }
3139}
3240
33- type reconcileContext struct {
41+ type contextImpl struct {
3442 context.Context
3543}
3644
37- func (c * reconcileContext ) WithReconcilerName (reconcilerName string ) * reconcileContext {
38- return & reconcileContext {Context : context .WithValue (c , reconcilerNameContextKey , reconcilerName )}
45+ func (c * contextImpl ) WithReconcilerName (reconcilerName string ) Context {
46+ return & contextImpl {Context : context .WithValue (c , reconcilerNameContextKey , reconcilerName )}
3947}
4048
41- func (c * reconcileContext ) WithClient (clnt cluster.Client ) * reconcileContext {
42- return & reconcileContext {Context : context .WithValue (c , clientContextKey , clnt )}
49+ func (c * contextImpl ) WithClient (clnt cluster.Client ) Context {
50+ return & contextImpl {Context : context .WithValue (c , clientContextKey , clnt )}
4351}
4452
45- func (c * reconcileContext ) WithComponent (component Component ) * reconcileContext {
46- return & reconcileContext {Context : context .WithValue (c , componentContextKey , component )}
53+ func (c * contextImpl ) WithComponent (component Component ) Context {
54+ return & contextImpl {Context : context .WithValue (c , componentContextKey , component )}
4755}
4856
49- func (c * reconcileContext ) WithComponentDigest (componentDigest string ) * reconcileContext {
50- return & reconcileContext {Context : context .WithValue (c , componentDigestContextKey , componentDigest )}
57+ func (c * contextImpl ) WithComponentDigest (componentDigest string ) Context {
58+ return & contextImpl {Context : context .WithValue (c , componentDigestContextKey , componentDigest )}
5159}
5260
5361func ReconcilerNameFromContext (ctx context.Context ) (string , error ) {
0 commit comments