// Init initializes the Hist with the given Config.
162541
func (h *Hist) Init(cfg Config) {
	if cfg.LowestDiscernible < 1 {
		panic("invalid cfg: LowestDiscernible must be >= 1")
	}
	if cfg.HighestTrackable < 2*cfg.LowestDiscernible {
		if cfg.AutoResize {
			cfg.HighestTrackable = 2 * cfg.LowestDiscernible
		} else {
			panic("invalid cfg: HighestTrackable must be >= 2*LowestDiscernible")
		}
	}
	if cfg.SigFigs < 0 || cfg.SigFigs > 5 {
		panic("invalid cfg: must have SigFigs ∈ [0,5]")
	}
	h.cfg = cfg

	unitMag := int32(math.Floor(math.Log2(float64(cfg.LowestDiscernible))))
	largestSingleUnitResolutionValue := 2 * math.Pow10(int(cfg.SigFigs))
	subCountMag := int32(math.Ceil(math.Log2(largestSingleUnitResolutionValue)))
	subHalfCountMag := int32(0)
	if subCountMag > 1 {
		subHalfCountMag = subCountMag - 1
	}
	subCount := int32(math.Pow(2, float64(subHalfCountMag+1)))
	subHalfCount := subCount / 2
	subMask := (int64(subCount) - 1) << uint64(unitMag)
	bucketCount := numBucketsToCoverVal(cfg.HighestTrackable, subCount, unitMag)
	countsLen := (bucketCount + 1) * subHalfCount

	h.b.counts = make([]int64, countsLen)
	h.b.subHalfCount = subHalfCount
	h.b.subHalfCountMag = subHalfCountMag
	h.b.subMask = subMask
	h.b.subCount = subCount
	h.b.bucketCount = bucketCount
	h.b.unitMag = unitMag
	h.b.leadZeroCountBase = 64 - unitMag - subHalfCountMag - 1
}
756109
func (f *FlagSet) Init(name string, errorHandling ErrorHandling) {
	f.name = name
	f.envPrefix = EnvironmentPrefix
	f.errorHandling = errorHandling
}
873338
func (p PhysicalIndexScan) Init(ctx sessionctx.Context) *PhysicalIndexScan {
	p.basePhysicalPlan = newBasePhysicalPlan(ctx, TypeIdxScan, &p)
	return &p
}
843319
func (d *driver) Init(ctx types.Context, config gofig.Config) error {
	d.config = config

	fields := log.Fields{
		"endpoint":   d.endpoint(),
		"userName":   d.userName(),
		"group":      d.group(),
		"insecure":   d.insecure(),
		"volumePath": d.volumePath(),
		"dataSubnet": d.dataSubnet(),
	}

	if d.password() == "" {
		fields["password"] = ""
	} else {
		fields["password"] = "******"
	}

	var err error

	if d.client, err = isi.NewClientWithArgs(ctx,
		d.endpoint(),
		d.insecure(),
		d.userName(),
		d.group(),
		d.password(),
		d.volumePath()); err != nil {
		return goof.WithFieldsE(fields,
			"error creating isilon client", err)
	}

	log.WithFields(fields).Info("storage driver initialized")
	return nil
}
70003
func (p *HelloWorld) Init() error {
	p.Log.Debug("Loading config..")
	// Load config file.
	cfg := defaultConfig()
	found, err := p.Cfg.LoadValue(cfg)
	if err != nil {
		return err
	} else if !found {
		p.Log.Warnf("config not found")
	}

	p.Log.Info(cfg.Greeting)
	return nil
}
1151967
func (d *driver) Init(ctx types.Context, config gofig.Config) error {
	d.config = config

	fields := map[string]interface{}{
		"provider":        vbox.Name,
		"moduleName":      vbox.Name,
		"endpoint":        d.endpoint(),
		"userName":        d.username(),
		"tls":             d.tls(),
		"volumePath":      d.volumePath(),
		"controllerName":  d.controllerName(),
		"machineNameOrId": d.machineNameID(""),
	}

	ctx.Info("initializing driver: ", fields)
	d.vbox = vboxc.New(d.username(), d.password(),
		d.endpoint(), d.tls(), d.controllerName())

	if err := d.vbox.Logon(); err != nil {
		return goof.WithFieldsE(fields,
			"error logging in", err)
	}

	ctx.WithFields(fields).Info("storage driver initialized")
	return nil
}
1092683
func (plugin *ExamplePlugin) Init() (err error) {
	plugin.Log.Info("Loading plugin config ", plugin.PluginConfig.GetConfigName())

	if plugin.Conf == nil {
		plugin.Conf = &Conf{Field1: "some default value"}
	}

	found, err := plugin.PluginConfig.LoadValue(plugin.Conf)
	if err != nil {
		plugin.Log.Error("Error loading config", err)
	} else if found {
		plugin.Log.Info("Loaded plugin config - found external configuration ", plugin.PluginConfig.GetConfigName())
	} else {
		plugin.Log.Info("Loaded plugin config - default")
	}
	plugin.Log.Info("Plugin Config ", plugin.Conf)

	time.Sleep(plugin.Conf.Sleep)
	close(plugin.exampleFinished)

	return nil
}
671059
func (fc *FileContent) Init(c *config.Config, logger *logrus.Entry) {
	fc.c = c
	fc.dataFile = c.Choria.FileContentRegistrationData
	fc.log = logger.WithFields(logrus.Fields{"registration": "file_content", "source": fc.dataFile})

	fc.log.Infof("Configured File Content Registration with source '%s' and target '%s'", fc.dataFile, c.Choria.FileContentRegistrationTarget)
}
228566
func Init(repoPath string, conf *config.Config) error {

	// packageLock must be held to ensure that the repo is not initialized more
	// than once.
	packageLock.Lock()
	defer packageLock.Unlock()

	if isInitializedUnsynced(repoPath) {
		return nil
	}

	if err := initConfig(repoPath, conf); err != nil {
		return err
	}

	if err := initSpec(repoPath, conf.Datastore.Spec); err != nil {
		return err
	}

	if err := mfsr.RepoPath(repoPath).WriteVersion(RepoVersion); err != nil {
		return err
	}

	return nil
}
301890
func (base basePhysicalAgg) Init(ctx sessionctx.Context, stats *property.StatsInfo) *basePhysicalAgg {
	base.basePhysicalPlan = newBasePhysicalPlan(ctx, TypeHashAgg, &base)
	base.stats = stats
	return &base
}
486319
func (c *config) Init() error {
	err := c.handler.Init()
	c.log(INIT, err)
	return err
}
960270
func (n *NoneParser) Init(b *bytes.Buffer) bool {
	m := make(map[string]interface{})
	n.metadata = NewMetadata(m)
	n.markdown = bytes.NewBuffer(b.Bytes())

	return true
}
885012
func (tm *TrustMetric) Init(hist MetricHistoryJSON) {
	// Restore the number of time intervals we have previously tracked
	if hist.NumIntervals > tm.maxIntervals {
		hist.NumIntervals = tm.maxIntervals
	}
	tm.numIntervals = hist.NumIntervals
	// Restore the history and its current size
	if len(hist.History) > tm.historyMaxSize {
		// Keep the history no larger than historyMaxSize
		last := len(hist.History) - tm.historyMaxSize
		hist.History = hist.History[last:]
	}
	tm.history = hist.History
	tm.historySize = len(tm.history)
	// Create the history weight values and weight sum
	for i := 1; i <= tm.numIntervals; i++ {
		x := math.Pow(defaultHistoryDataWeight, float64(i)) // Optimistic weight
		tm.historyWeights = append(tm.historyWeights, x)
	}

	for _, v := range tm.historyWeights {
		tm.historyWeightSum += v
	}
	// Calculate the history value based on the loaded history data
	tm.historyValue = tm.calcHistoryValue()
}
339545
func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) {
	p.init(typ, name, tag, f, true)
}
657437
func (s *BaseGenerator) Init() {
	s.Position = vm.Position{State: vm.NewState()}
}
432879
func (s *scanner) init(buf string) {
	s.buf = buf
	s.pos = 0
	s.start = 0
	s.width = 0
	s.accept = nil
}
706290
func (c *defaultsCommand) Init(args []string) error {
	// There's no way of distinguishing a cloud name
	// from a model configuration setting without contacting the
	// API, but we aren't allowed to contact the API at Init time,
	// so we defer parsing the arguments until Run is called.
	c.args = args
	return nil
}