// NewContextWithNamespace sets the namespace to use in the context. The
// namespace is used to determine which database.
762713
func NewContextWithNamespace(ctx context.Context, namespace string) context.Context {
	return context.WithValue(ctx, namespaceKey, namespace)
}
294329
func NewContext(label string) (Context, error) {
	c := make(Context)
	return c, nil
}
993643
func NewContext() context {
	var ctx context
	ctx.values = make(map[string]map[string]string)

	return ctx
}
209088
func NewNamespaceMetadata(Name string, NamespaceId string, NamespaceType *NamespaceType) *NamespaceMetadata {
	s := new(NamespaceMetadata)
	s.Name = Name
	s.NamespaceId = NamespaceId
	s.NamespaceType = NamespaceType
	return s
}
306462
func NewCONTEXT() *CONTEXT {
	var c *CONTEXT
	buf := make([]byte, unsafe.Sizeof(*c)+15)
	return (*CONTEXT)(unsafe.Pointer((uintptr(unsafe.Pointer(&buf[15]))) &^ 15))
}
181677
func NewContext(ctx context.Context, logger KayveeLogger) context.Context {
	return context.WithValue(ctx, loggerKey, logger)
}
129505
func WithNamespace(parent context.Context, namespace string) context.Context {
	return WithValue(parent, namespaceKey, namespace)
}
160894
func New(deps *deps.Deps) *Namespace {
	cache := namedmemcache.New()
	deps.BuildStartListeners.Add(
		func() {
			cache.Clear()
		})

	return &Namespace{
		cache: cache,
		deps:  deps,
	}
}
898564
func newContext(ctx context.Context, resource, name string, gvk schema.GroupVersionKind) context.Context {
	oldInfo, found := genericapirequest.RequestInfoFrom(ctx)
	if !found {
		return ctx
	}
	newInfo := genericapirequest.RequestInfo{
		IsResourceRequest: true,
		Verb:              "get",
		Namespace:         oldInfo.Namespace,
		Resource:          resource,
		Name:              name,
		Parts:             []string{resource, name},
		APIGroup:          gvk.Group,
		APIVersion:        gvk.Version,
	}
	return genericapirequest.WithRequestInfo(ctx, &newInfo)
}
940225
func Namespace(ctx context.Context) (string, bool) {
	namespace, ok := ctx.Value(namespaceKey{}).(string)
	if !ok {
		return fromGRPCHeader(ctx)
	}

	return namespace, ok
}
1213086
func NamespaceFrom(ctx context.Context) (string, bool) {
	namespace, ok := ctx.Value(namespaceKey).(string)
	return namespace, ok
}
517682
func NewContext(res http.ResponseWriter, req *http.Request) *Context {
	return NewContextWith(res, req, nil)
}
1175715
func NewContextWithGroup(ctx context.Context, c *Group) context.Context {
	return context.WithValue(ctx, groupKey, c)
}
557394
func NewContext(ctx context.Context, l log15.Logger) context.Context {
	return context.WithValue(ctx, loggerKey, l)
}
841658
func NewContext(api APIClient, dataDir string) *Context {
	return &Context{
		api:      api,
		dataDir:  dataDir,
		payloads: make(map[string]payload.Payload),
		updates:  make(map[string]payload.Payload),
	}
}
637991
func NewContextWith(res http.ResponseWriter, req *http.Request, loga *log.Logger) *Context {
	if loga == nil {
		loga = log.New(os.Stdout, "[Relay] ", 0)
	}

	cx := Context{
		SyncCollector: NewSyncCollector(),
		Req:           req,
		Res:           NewResponseWriter(res),
		Log:           loga,
	}
	return &cx
}
1368808
func NewContext(ctx context.Context, serialId *big.Int) context.Context {
	var c *Client
	var err error
	if c, err = GetClient(util.BigIntToHex(serialId)); err != nil {
		return ctx
	}
	return context.WithValue(ctx, clientKey{}, c)
}