You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
level of integration with golang.org/x/net/context.Context #156
Some work has begun in integrating golang.org/x/net/context, such as #151. Most of this has been done with an eye on logging. Specifically, we are effectively using the context to inject loggers into disparate parts of the application.
To what extent do we have the stable APIs integrate context? For example, do we have every method start with context or do we have objects that can be created with a context use a given context.
Where do we draw the line for injection using the context? It seems to make sense with loggers and maybe authentication credentials, but where do we draw this line? Do we define rules?
Where should it be acceptable to create new contexts? Does this only happen at request time? Or should arbitrary method calls be able to take and return a new context?
Having said that, I've been working on other tasks and am just now getting back to working on integrating the v2 registry into OpenShift. I'll have some more comments as I dig through the code.
FWIW, we considered using golang.org/x/net/context in the past for some pieces of the network plugins, and it does sound like a good idea. However, our initial intention was to either recode it (it's small enough) or wrap it to avoid being locked on a third party which appears in each and every of our methods signatures.
@icecrime What if we duplicated the declaration in distribution/context? For now, I say we go full hog, as the benefits are great, with the caveat that we change the source of the definition. Ultimately, they will be cross-compatible.
The other option is this:
type Context interface {
golang.org/x/net/context.Context
}
Activity
stevvooe commentedon Feb 10, 2015
cc @dmcgowan @jlhawn @dmp42 @ncdc
ncdc commentedon Feb 23, 2015
Sorry for the delay in commenting. I think it's ok for methods to take in a Context as the first parameter.
ncdc commentedon Feb 23, 2015
Having said that, I've been working on other tasks and am just now getting back to working on integrating the v2 registry into OpenShift. I'll have some more comments as I dig through the code.
icecrime commentedon Feb 26, 2015
FWIW, we considered using
golang.org/x/net/contextin the past for some pieces of the network plugins, and it does sound like a good idea. However, our initial intention was to either recode it (it's small enough) or wrap it to avoid being locked on a third party which appears in each and every of our methods signatures.stevvooe commentedon Feb 26, 2015
@icecrime What if we duplicated the declaration in distribution/context? For now, I say we go full hog, as the benefits are great, with the caveat that we change the source of the definition. Ultimately, they will be cross-compatible.
The other option is this:
Then use that everywhere.
icecrime commentedon Feb 26, 2015
I don't have a clear preference, I guess both work.
stevvooe commentedon Mar 14, 2015
We are going to integrate google context throughout. While requiring context everywhere is "ugly", the benefits are clear.