// NewContextRelation creates a new context for the given relation unit.
// The unit-name keys of members supplies the initial membership.
339673
func NewContextRelation(ru *uniter.RelationUnit, cache *RelationCache) *ContextRelation {
	return &ContextRelation{
		ru:           ru,
		relationId:   ru.Relation().Id(),
		endpointName: ru.Endpoint().Name,
		cache:        cache,
	}
}
278907
func NewContext(l *LARS) *Ctx {

	c := &Ctx{
		params: make(Params, l.mostParams),
	}

	c.response = newResponse(nil, c)

	return c
}
410742
func NewContext(cfg *AppContextConfig) *appContext {
	conns, _ := cfg.Client.GetConnectionCount()
	nodeHeight, _ := cfg.Client.GetBlockCount()

	// auxDataSource is an interface that could have a value of pointer type.
	if cfg.DBSource == nil || reflect.ValueOf(cfg.DBSource).IsNil() {
		log.Errorf("NewContext: a DataSourceAux is required.")
		return nil
	}

	return &appContext{
		nodeClient:    cfg.Client,
		Params:        cfg.Params,
		BlockData:     cfg.DataSource,
		AuxDataSource: cfg.DBSource,
		xcBot:         cfg.XcBot,
		AgendaDB:      cfg.AgendasDBInstance,
		Status:        apitypes.NewStatus(uint32(nodeHeight), conns, APIVersion, appver.Version(), cfg.Params.Name),
		JSONIndent:    cfg.JsonIndent,
		maxCSVAddrs:   cfg.MaxAddrs,
		charts:        cfg.Charts,
	}
}
1270329
func NewContext(label string) (Context, error) {
	c := make(Context)

	if len(label) != 0 {
		con := strings.SplitN(label, ":", 4)
		if len(con) < 3 {
			return c, InvalidLabel
		}
		c["user"] = con[0]
		c["role"] = con[1]
		c["type"] = con[2]
		if len(con) > 3 {
			c["level"] = con[3]
		}
	}
	return c, nil
}
487315
func (c *Canceller) NewContext() (context.Context, context.CancelFunc) {
	return context.WithCancel(c.ctx)
}
259509
func NewContext(ctx context.Context) context.Context {
	u, _ := uuid.NewV4()
	uStr := u.String()
	ctx = context.WithValue(ctx, requestUuidKey, uStr)
	ctx = context.WithValue(ctx, processPidKey, strconv.Itoa(os.Getpid()))
	ctx = context.WithValue(ctx, additionnalLogElementsKey, make(map[interface{}]interface{}))
	return ctx
}
731118
func NewContextReader(ctx context.Context, r io.Reader) io.Reader {
	return ctxio.NewReader(ctx, r)
}
298871
func NewContext(ctx context.Context, msg *sqs.Message) context.Context {
	return context.WithValue(ctx, sqsMessageKey, msg)
}
1258074
func NewContext(app *App, set *flag.FlagSet, parentCtx *Context) *Context {
	c := &Context{App: app, flagSet: set, parentContext: parentCtx}

	if parentCtx != nil {
		c.shellComplete = parentCtx.shellComplete
	}

	return c
}
294329
func NewContext(label string) (Context, error) {
	c := make(Context)
	return c, nil
}
256890
func NewContext() *Context {
	ctx := &Context{Context: duktape.New()}
	ctx.storage = newStorage()
	ctx.pushGlobalCandyJSObject()

	return ctx
}
744010
func (db *Conn) WithContext(ctx context.Context) *Conn {
	return newConn(ctx, db.baseDB)
}
762803
func NewContext(d Device, flags ContextFlags) *Ctx {
	var cctx C.CUcontext
	err := result(C.cuCtxCreate(&cctx, C.uint(flags), C.CUdevice(d)))
	if err != nil {
		panic(err)
	}
	ctx := newContext(makeContext(cctx))
	ctx.device = d
	ctx.flags = flags

	errChan := make(chan error)
	go ctx.Run(errChan)
	if err := <-errChan; err != nil {
		panic(err)
	}

	return ctx
}
990858
func NewContextFromGlobalContext(g *libkb.GlobalContext) *KBFSContext {
	c := &KBFSContext{g: g}
	c.initKBFSSocket()
	return c
}
293888
func NewContext(mode ...int) *Context {
	context := &Context{
		Iterations:  3,
		Memory:      1 << 12, // 4 MiB
		Parallelism: 1,
		HashLen:     32,
		Mode:        ModeArgon2i,
		Version:     VersionDefault,
	}
	if len(mode) >= 1 {
		context.Mode = mode[0]
	}
	return context
}
601305
func NewContext(ctx context.Context, rw http.ResponseWriter, req *http.Request, params url.Values) context.Context {
	if ctx == nil {
		ctx = context.Background()
	}
	request := &RequestData{Request: req, Params: params}
	response := &ResponseData{ResponseWriter: rw}
	ctx = context.WithValue(ctx, respKey, response)
	ctx = context.WithValue(ctx, reqKey, request)

	return ctx
}
631389
func NewContextComponentName(ctx context.Context, componentName string) context.Context {
	return context.WithValue(ctx, ctxKeyComponent, componentName)
}