// Setup tracking for this account. This allows us to track globally
// account activity.
// Lock should be held on entry.
166680
func (s *Server) enableAccountTracking(a *Account) {
	if a == nil || !s.eventsEnabled() {
		return
	}

	// TODO(ik): Generate payload although message may not be sent.
	// May need to ensure we do so only if there is a known interest.
	// This can get complicated with gateways.

	subj := fmt.Sprintf(accConnsReqSubj, a.Name)
	reply := fmt.Sprintf(connsRespSubj, s.info.ID)
	m := accNumConnsReq{Account: a.Name}
	s.sendInternalMsg(subj, reply, &m.Server, &m)
}
864403
func (handler *handler) SetUp() (watcher.StringsWatcher, error) {
	return handler.config.Facade.Watch()
}
721862
func (n *natsRequester) Setup() error {
	conn, err := nats.Connect(n.url)
	if err != nil {
		return err
	}
	sub, err := conn.SubscribeSync(n.subject)
	if err != nil {
		conn.Close()
		return err
	}
	n.conn = conn
	n.sub = sub
	n.msg = make([]byte, n.payloadSize)
	return nil
}
51816
func (mgr *mspManagerImpl) Setup(msps []MSP) error {
	if mgr.up {
		mspLogger.Infof("MSP manager already up")
		return nil
	}

	mspLogger.Debugf("Setting up the MSP manager (%d msps)", len(msps))

	// create the map that assigns MSP IDs to their manager instance - once
	mgr.mspsMap = make(map[string]MSP)

	// create the map that sorts MSPs by their provider types
	mgr.mspsByProviders = make(map[ProviderType][]MSP)

	for _, msp := range msps {
		// add the MSP to the map of active MSPs
		mspID, err := msp.GetIdentifier()
		if err != nil {
			return errors.WithMessage(err, "could not extract msp identifier")
		}
		mgr.mspsMap[mspID] = msp
		providerType := msp.GetType()
		mgr.mspsByProviders[providerType] = append(mgr.mspsByProviders[providerType], msp)
	}

	mgr.up = true

	mspLogger.Debugf("MSP manager setup complete, setup %d msps", len(msps))

	return nil
}
842737
func (mounter *quobyteMounter) SetUp(fsGroup *int64) error {
	pluginDir := mounter.plugin.host.GetPluginDir(utilstrings.EscapeQualifiedName(quobytePluginName))
	return mounter.SetUpAt(pluginDir, fsGroup)
}
446049
func SetupLogging(w io.Writer) {

	if w == nil {
		w = os.Stderr
	}

	logger := kitlog.NewLogfmtLogger(kitlog.NewSyncWriter(w))

	if internal != nil {
		logger.Log("event", "warning", "msg", "logging inited twice")
		return
	}

	if lvl := os.Getenv("CRYPTIX_LOGLVL"); lvl != "" {
		logger.Log("module", "logging", "error", "CRYPTIX_LOGLVL is obsolete. levels are bad, mkay?")
	}
	// wrap logger to error-check the writes only once
	internal = kitlog.LoggerFunc(func(keyvals ...interface{}) error {
		if err := logger.Log(keyvals...); err != nil {
			fmt.Fprintf(w, "warning: logger.Write() failed! %s - vals: %v", err, keyvals)
			panic(err) // no other way to escalate this
		}
		return nil
	})
	internal = kitlog.With(internal, "time", kitlog.DefaultTimestamp, "caller", kitlog.DefaultCaller)
	stdlog.SetOutput(kitlog.NewStdlibAdapter(kitlog.With(internal, "module", "stdlib")))
}
173172
func (t *SubprocessTest) SetUp(ti *ogletest.TestInfo) {
	err := t.initialize(ti.Ctx)
	if err != nil {
		panic(err)
	}
}
441047
func (*DefaultScene) Setup(u engo.Updater) {
	w, _ := u.(*ecs.World)

	common.SetBackground(color.White)
	w.AddSystem(&common.RenderSystem{})

	// The most important line in this whole demo:
	w.AddSystem(common.NewKeyboardScroller(scrollSpeed, engo.DefaultHorizontalAxis, engo.DefaultVerticalAxis))

	// Create the background; this way we'll see when we actually scroll
	demoutils.NewBackground(w, worldWidth, worldHeight, color.RGBA{102, 153, 0, 255}, color.RGBA{102, 173, 0, 255})

	// Center camera if GlobalScale is Setup
	engo.Mailbox.Dispatch(common.CameraMessage{Axis: common.XAxis,
		Value:       float32(worldWidth) / 2,
		Incremental: false})
	engo.Mailbox.Dispatch(common.CameraMessage{Axis: common.YAxis,
		Value:       float32(worldHeight) / 2,
		Incremental: false})
}
405940
func (o *OrganizerModern) Setup(f func()) {
	o.setup = append(o.setup, f)
}
729554
func (c *Config) Setup(componentName string) (opentracing.Tracer, io.Closer, error) {
	jcfg := jaegercfg.Configuration{
		Sampler: &jaegercfg.SamplerConfig{
			SamplingServerURL: c.SamplingServerURL,
			Type:              c.SamplingType,
			Param:             c.SamplingParam,
		},
		Reporter: &jaegercfg.ReporterConfig{
			LogSpans:           true,
			LocalAgentHostPort: c.LocalAgentHostPort,
		},
		Headers: &jaeger.HeadersConfig{
			TraceContextHeaderName: c.TraceContextHeaderName,
		},
	}

	jMetricsFactory := jaegermet.NullFactory

	opts := []jaegercfg.Option{
		jaegercfg.Logger(newJaegerLogger()),
		jaegercfg.Metrics(jMetricsFactory),
		jaegercfg.Gen128Bit(c.Gen128Bit),
	}

	switch c.Propagation {
	case "b3":
		p := zipkin.NewZipkinB3HTTPHeaderPropagator()
		opts = append(opts,
			jaegercfg.Injector(opentracing.HTTPHeaders, p),
			jaegercfg.Extractor(opentracing.HTTPHeaders, p),
		)
	case "jaeger", "":
	default:
		return nil, nil, fmt.Errorf("unknown propagation format: %s", c.Propagation)
	}

	// Initialize tracer with a logger and a metrics factory
	closer, err := jcfg.InitGlobalTracer(
		componentName,
		opts...,
	)
	if err != nil {
		log.WithoutContext().Warnf("Could not initialize jaeger tracer: %s", err.Error())
		return nil, nil, err
	}
	log.WithoutContext().Debug("Jaeger tracer configured")

	return opentracing.GlobalTracer(), closer, nil
}
533533
func (nc *Conn) setup() {
	nc.subs = make(map[int64]*Subscription)
	nc.pongs = make([]chan struct{}, 0, 8)

	nc.fch = make(chan struct{}, flushChanSize)

	// Setup scratch outbound buffer for PUB
	pub := nc.scratch[:len(_PUB_P_)]
	copy(pub, _PUB_P_)
}
685849
func Setup(opts r.ConnectOpts) error {
	// Initialize a new setup connection
	ss, err := r.Connect(opts)
	if err != nil {
		return err
	}

	// Create databases
	for _, d := range databaseNames {
		r.DBCreate(d).Exec(ss)

		r.DB(d).TableCreate("accounts").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("name").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("alt_email").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("type").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("status").Exec(ss)

		r.DB(d).TableCreate("addresses").Exec(ss)
		r.DB(d).Table("addresses").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("addresses").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("addresses").IndexCreate("date_modified").Exec(ss)

		r.DB(d).TableCreate("contacts").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("name").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("date_modified").Exec(ss)

		r.DB(d).TableCreate("emails").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("thread").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("kind").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("from").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("message_id").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("to", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("emails").IndexCreate("cc", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("emails").IndexCreate("bcc", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("emails").IndexCreateFunc("messageIDOwner", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("message_id"),
				row.Field("owner"),
			}
		}).Exec(ss)
		r.DB(d).Table("emails").IndexCreateFunc("threadStatus", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("thread"),
				row.Field("status"),
			}
		}).Exec(ss)

		r.DB(d).TableCreate("files").Exec(ss)
		r.DB(d).Table("files").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("files").IndexCreate("name").Exec(ss)
		r.DB(d).Table("files").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("files").IndexCreate("date_modified").Exec(ss)

		r.DB(d).TableCreate("keys").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("key_id").Exec(ss)

		r.DB(d).TableCreate("labels").Exec(ss)
		r.DB(d).Table("labels").IndexCreate("name").Exec(ss)
		r.DB(d).Table("labels").IndexCreate("builtin").Exec(ss)
		r.DB(d).Table("labels").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("labels").IndexCreateFunc("nameOwnerBuiltin", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("name"),
				row.Field("owner"),
				row.Field("builtin"),
			}
		}).Exec(ss)

		r.DB(d).TableCreate("threads").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("name").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("emails", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("threads").IndexCreate("labels", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("threads").IndexCreate("members", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("threads").IndexCreate("subject_hash").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("secure").Exec(ss)
		r.DB(d).Table("threads").IndexCreateFunc("subjectOwner", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("subject_hash"),
				row.Field("owner"),
			}
		}).Exec(ss)

		r.DB(d).TableCreate("tokens").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("name").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("type").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("expiry_date").Exec(ss)

		r.DB(d).TableCreate("webhooks").Exec(ss)
		r.DB(d).Table("webhooks").IndexCreate("target").Exec(ss)
		r.DB(d).Table("webhooks").IndexCreate("type").Exec(ss)
		r.DB(d).Table("webhooks").IndexCreateFunc("targetType", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("target"),
				row.Field("type"),
			}
		}).Exec(ss)
	}

	return ss.Close()
}
1239291
func (r Account) GetInProgressExternalAccountSetup() (resp datatypes.Account_External_Setup, err error) {
	err = r.Session.DoRequest("SoftLayer_Account", "getInProgressExternalAccountSetup", nil, &r.Options, &resp)
	return
}
1241822
func (m *localVolumeMounter) SetUp(fsGroup *int64) error {
	return m.SetUpAt(m.GetPath(), fsGroup)
}
757219
func setup(c *caddy.Controller) error {
	rules, err := logParse(c)
	if err != nil {
		return err
	}

	for _, rule := range rules {
		for _, entry := range rule.Entries {
			entry.Log.Attach(c)
		}
	}

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return Logger{Next: next, Rules: rules, ErrorFunc: httpserver.DefaultErrorFunc}
	})

	return nil
}
1214292
func (ts *TemporalSet) Setup() error {
	if ts.Name == "" {
		return errors.New("Name cannot be empty")
	}
	if len(ts.Shards) == 0 {
		return errors.New("temporal set contains no shards")
	}
	for i := range ts.Shards {
		if ts.Shards[i].WindowEnd.Before(ts.Shards[i].WindowStart) ||
			ts.Shards[i].WindowEnd.Equal(ts.Shards[i].WindowStart) {
			return errors.New("WindowStart must be before WindowEnd")
		}
	}
	return nil
}
846737
func (s *GlobalSecondaryIndexUpdate) SetUpdate(v *UpdateGlobalSecondaryIndexAction) *GlobalSecondaryIndexUpdate {
	s.Update = v
	return s
}