// Init the driver with a core.Config.
962486
func (d *EtcdStateDriver) Init(instInfo *core.InstanceInfo) error {
	var err error
	var endpoint *url.URL

	if instInfo == nil || instInfo.DbURL == "" {
		return errors.New("no etcd config found")
	}
	endpoint, err = url.Parse(instInfo.DbURL)
	if err != nil {
		return err
	}
	if endpoint.Scheme == "etcd" {
		endpoint.Scheme = "http"
	} else if endpoint.Scheme != "http" && endpoint.Scheme != "https" {
		return core.Errorf("invalid etcd URL scheme %q", endpoint.Scheme)
	}
	// TODO: support multi-endpoints
	etcdConfig := client.Config{
		Endpoints: []string{endpoint.String()},
	}

	d.Client, err = client.New(etcdConfig)
	if err != nil {
		log.Fatalf("error creating etcd client. Err: %v", err)
	}

	// Create keys api
	d.KeysAPI = client.NewKeysAPI(d.Client)

	return nil
}
57084
func Init(params map[string]string) (volume.VolumeDriver, error) {
	return &driver{
		volume.IONotSupported,
		volume.BlockNotSupported,
		volume.SnapshotNotSupported,
		common.NewDefaultStoreEnumerator(Name, kvdb.Instance()),
		volume.StatsNotSupported,
		volume.CredsNotSupported,
		volume.CloudBackupNotSupported,
		volume.CloudMigrateNotSupported,
	}, nil
}
700380
func (p *Plugin) Init() (err error) {
	if p.Config == nil {
		p.Config, err = p.getConfig()
		if err != nil || p.disabled {
			return err
		}
	}

	p.boltClient, err = NewClient(p.Config)
	if err != nil {
		p.Log.Errorf("Err: %v", err)
		return err
	}

	p.protoWrapper = kvproto.NewProtoWrapper(p.boltClient, &keyval.SerializerJSON{})

	p.Log.Infof("BoltDB started with: %v", p.Config.DbPath)

	return nil
}
709261
func init() {

	docsProvider := func() map[string]interface{} {
		docs := make(map[string]interface{})

		var chromaLexers []interface{}

		sort.Sort(lexers.Registry.Lexers)

		for _, l := range lexers.Registry.Lexers {

			config := l.Config()

			var filenames []string
			filenames = append(filenames, config.Filenames...)
			filenames = append(filenames, config.AliasFilenames...)

			aliases := config.Aliases

			for _, filename := range filenames {
				alias := strings.TrimSpace(strings.TrimPrefix(filepath.Ext(filename), "."))
				if alias != "" {
					aliases = append(aliases, alias)
				}
			}

			sort.Strings(aliases)
			aliases = UniqueStrings(aliases)

			lexerEntry := struct {
				Name    string
				Aliases []string
			}{
				config.Name,
				aliases,
			}

			chromaLexers = append(chromaLexers, lexerEntry)

			docs["lexers"] = chromaLexers
		}
		return docs

	}

	docshelper.AddDocProvider("chroma", docsProvider)
}
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
}
999238
func (d *VppDriver) Init(info *core.InstanceInfo) error {
	log.Infof("Initializing vppdriver")

	return nil
}
415851
func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
	deviceSet, err := NewDeviceSet(home, true, options, uidMaps, gidMaps)
	if err != nil {
		return nil, err
	}

	d := &Driver{
		DeviceSet: deviceSet,
		home:      home,
		uidMaps:   uidMaps,
		gidMaps:   gidMaps,
		ctr:       graphdriver.NewRefCounter(graphdriver.NewDefaultChecker()),
		locker:    locker.New(),
	}

	return graphdriver.NewNaiveDiffDriver(d, uidMaps, gidMaps), nil
}
519876
func (c *Conf) initConfig() {
	if c.Exist() {
		return
	}

	err := os.MkdirAll(c.dirPath, 0755)
	if err != nil {
		panic(err)
	}

	_, err = os.Create(c.Path())
	if err != nil {
		panic(err)
	}

	bc := map[string]string{
		"init": "true",
	}
	b, err := json.Marshal(bc)
	if err != nil {
		panic(err)
	}

	err = ioutil.WriteFile(c.Path(), b, 0666)
	if err != nil {
		panic(err)
	}
}
897560
func Init(root string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {

	// Try to load the aufs kernel module
	if err := supportsAufs(); err != nil {
		return nil, errors.Wrap(graphdriver.ErrNotSupported, "kernel does not support aufs")

	}

	fsMagic, err := graphdriver.GetFSMagic(root)
	if err != nil {
		return nil, err
	}
	if fsName, ok := graphdriver.FsNames[fsMagic]; ok {
		backingFs = fsName
	}

	switch fsMagic {
	case graphdriver.FsMagicAufs, graphdriver.FsMagicBtrfs, graphdriver.FsMagicEcryptfs:
		logrus.Errorf("AUFS is not supported over %s", backingFs)
		return nil, errors.Wrapf(graphdriver.ErrIncompatibleFS, "AUFS is not supported over %q", backingFs)
	}

	var mountOptions string
	for _, option := range options {
		key, val, err := parsers.ParseKeyValueOpt(option)
		if err != nil {
			return nil, err
		}
		key = strings.ToLower(key)
		switch key {
		case "aufs.mountopt":
			mountOptions = val
		default:
			return nil, fmt.Errorf("option %s not supported", option)
		}
	}
	paths := []string{
		"mnt",
		"diff",
		"layers",
	}

	a := &Driver{
		root:         root,
		uidMaps:      uidMaps,
		gidMaps:      gidMaps,
		pathCache:    make(map[string]string),
		ctr:          graphdriver.NewRefCounter(graphdriver.NewFsChecker(graphdriver.FsMagicAufs)),
		locker:       locker.New(),
		mountOptions: mountOptions,
	}

	rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
	if err != nil {
		return nil, err
	}
	// Create the root aufs driver dir and return
	// if it already exists
	// If not populate the dir structure
	if err := idtools.MkdirAllAs(root, 0700, rootUID, rootGID); err != nil {
		if os.IsExist(err) {
			return a, nil
		}
		return nil, err
	}

	if err := mountpk.MakePrivate(root); err != nil {
		return nil, err
	}

	// Populate the dir structure
	for _, p := range paths {
		if err := idtools.MkdirAllAs(path.Join(root, p), 0700, rootUID, rootGID); err != nil {
			return nil, err
		}
	}
	logger := logrus.WithFields(logrus.Fields{
		"module": "graphdriver",
		"driver": "aufs",
	})

	for _, path := range []string{"mnt", "diff"} {
		p := filepath.Join(root, path)
		entries, err := ioutil.ReadDir(p)
		if err != nil {
			logger.WithError(err).WithField("dir", p).Error("error reading dir entries")
			continue
		}
		for _, entry := range entries {
			if !entry.IsDir() {
				continue
			}
			if strings.HasSuffix(entry.Name(), "-removing") {
				logger.WithField("dir", entry.Name()).Debug("Cleaning up stale layer dir")
				if err := system.EnsureRemoveAll(filepath.Join(p, entry.Name())); err != nil {
					logger.WithField("dir", entry.Name()).WithError(err).Error("Error removing stale layer dir")
				}
			}
		}
	}

	a.naiveDiff = graphdriver.NewNaiveDiffDriver(a, a)
	return a, nil
}
799717
func Init(dc driverapi.DriverCallback, config map[string]interface{}) error {
	var err error
	c := driverapi.Capability{
		DataScope:         datastore.GlobalScope,
		ConnectivityScope: datastore.GlobalScope,
	}

	d := &driver{
		networks: networkTable{},
		config:   config,
	}

	d.vxlanIdm, err = idm.New(nil, "vxlan-id", 0, vxlanIDEnd)
	if err != nil {
		return fmt.Errorf("failed to initialize vxlan id manager: %v", err)
	}

	return dc.RegisterDriver(networkType, d, c)
}
12533
func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
	deviceSet, err := NewDeviceSet(home, true, options, uidMaps, gidMaps)
	if err != nil {
		return nil, err
	}

	if err := mount.MakePrivate(home); err != nil {
		return nil, err
	}

	d := &Driver{
		DeviceSet: deviceSet,
		home:      home,
		uidMaps:   uidMaps,
		gidMaps:   gidMaps,
	}

	return graphdriver.NewNaiveDiffDriver(d, uidMaps, gidMaps), nil
}
236571
func Init(c *config.Config) (*Service, error) {
	return &Service{Config: c}, nil
}
1007584
func Init(cfg config.ClusterConfig) error {
	if inst != nil {
		return errClusterInitialized
	}

	kv := kvdb.Instance()
	if kv == nil {
		return errors.New("KVDB is not yet initialized.  " +
			"A valid KVDB instance required for the cluster to start.")
	}

	inst = &ClusterManager{
		listeners:          list.New(),
		config:             cfg,
		kv:                 kv,
		nodeCache:          make(map[string]api.Node),
		nodeStatuses:       make(map[string]api.Status),
		systemTokenManager: auth.SystemTokenManagerInst(),
	}

	return nil
}
306338
func init() {
	registry.RegisterConfigReg(
		"Integration",
		func(ctx types.Context, r gofig.ConfigRegistration) {

			r.Key(
				gofig.String,
				"", "ext4", "",
				types.ConfigIgVolOpsCreateDefaultFsType)

			r.Key(
				gofig.String,
				"", "", "", types.ConfigIgVolOpsCreateDefaultType)

			r.Key(
				gofig.String,
				"", "", "",
				types.ConfigIgVolOpsCreateDefaultIOPS)

			r.Key(
				gofig.String,
				"", "16", "",
				types.ConfigIgVolOpsCreateDefaultSize)

			r.Key(
				gofig.String,
				"", "", "",
				types.ConfigIgVolOpsCreateDefaultAZ)

			r.Key(
				gofig.String,
				"",
				path.Join(context.MustPathConfig(ctx).Lib, "volumes"),
				"",
				types.ConfigIgVolOpsMountPath)

			r.Key(
				gofig.String,
				"", "/data", "",
				types.ConfigIgVolOpsMountRootPath)

			r.Key(
				gofig.Bool,
				"", true, "",
				types.ConfigIgVolOpsCreateImplicit)

			r.Key(
				gofig.Bool,
				"", false, "",
				types.ConfigIgVolOpsMountPreempt)
		})
}
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
}
574790
func (r *Runner) init() {
	r.initOnce.Do(func() {
		r.workC = make(chan WorkItem)
		r.dispatchFinishedC = make(chan struct{})

		go r.dispatchLoop(r.Sustained, r.Maximum)
	})
}
956397
func (c *ConnWriter) Init(config map[string]interface{}) error {
	conf, err := json.Marshal(config)
	if err != nil {
		return err
	}
	return json.Unmarshal(conf, c)
}