// Setup sets up the key-value store specified in kvStore and configures it
// with the options provided in opts
329070
func Setup(selectedBackend string, opts map[string]string, goOpts *ExtraOptions) error {
	var err error

	setupOnce.Do(func() {
		err = setup(selectedBackend, opts, goOpts)
	})

	return err
}
319062
func (m *Source) Setup(s *schema.Schema) error {
	m.s = s
	return nil
}
354522
func (rm *RouteManager) Setup() error {
	var uris string
	if os.Getenv("ROUTE_URIS") != "" {
		uris = os.Getenv("ROUTE_URIS")
	}
	if len(os.Args) > 1 {
		uris = os.Args[1]
	}
	if uris != "" {
		for _, uri := range strings.Split(uris, ",") {
			err := rm.AddFromURI(uri)
			if err != nil {
				return err
			}
		}
	}

	persistPath := getopt("ROUTESPATH", "/mnt/routes")
	if _, err := os.Stat(persistPath); err == nil {
		return rm.Load(RouteFileStore(persistPath))
	}
	return nil
}
1148379
func (h *HCL) Setup() error {
	r, err := h.gen()
	if err != nil {
		return err
	}

	buf := new(bytes.Buffer)
	buf.ReadFrom(r)
	s := buf.String()

	//first parse the hcl file
	obj, err := hcl.Parse(s)
	if err != nil {
		return err
	}

	h.values = make(map[string]interface{})

	// then decode the object
	if err = hcl.DecodeObject(&h.values, obj); err != nil {
		return err
	}

	return nil
}
774274
func (t *PosixParser) Setup() error {
	// Set NonBlocking mode because if syscall.Read block this goroutine, it cannot receive data from stopCh.
	if err := syscall.SetNonblock(t.fd, true); err != nil {
		return err
	}
	if err := term.SetRaw(t.fd); err != nil {
		return err
	}
	return nil
}
173172
func (t *SubprocessTest) SetUp(ti *ogletest.TestInfo) {
	err := t.initialize(ti.Ctx)
	if err != nil {
		panic(err)
	}
}
1069193
func (*DefaultScene) Setup(u engo.Updater) {
	w, _ := u.(*ecs.World)

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

	// Adding KeyboardScroller so we can actually see the difference between the HUD and non-HUD text
	w.AddSystem(common.NewKeyboardScroller(scrollSpeed, engo.DefaultHorizontalAxis, engo.DefaultVerticalAxis))
	w.AddSystem(&common.MouseZoomer{zoomSpeed})

	fnt := &common.Font{
		URL:  "Roboto-Regular.ttf",
		FG:   color.Black,
		Size: 64,
	}
	err := fnt.CreatePreloaded()
	if err != nil {
		panic(err)
	}

	label1 := MyLabel{BasicEntity: ecs.NewBasic()}
	label1.RenderComponent.Drawable = common.Text{
		Font: fnt,
		Text: "Hello world !",
	}
	label1.SetShader(common.HUDShader)

	label2 := MyLabel{BasicEntity: ecs.NewBasic()}
	label2.RenderComponent.Drawable = common.Text{
		Font:          fnt,
		Text:          "This may also be text\nwhich includes a newline. ",
		LineSpacing:   0.5,
		LetterSpacing: 0.15,
	}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&label1.BasicEntity, &label1.RenderComponent, &label1.SpaceComponent)
			sys.Add(&label2.BasicEntity, &label2.RenderComponent, &label2.SpaceComponent)
		}
	}
}
482160
func (c *connectionBenchmark) setup() error {
	c.successHistogram.Reset()
	c.uncorrectedSuccessHistogram.Reset()
	c.errorHistogram.Reset()
	c.uncorrectedErrorHistogram.Reset()
	c.successTotal = 0
	c.errorTotal = 0
	return c.requester.Setup()
}
1116141
func (c *Client) Setup() error {
	if c.IsSetup() {
		return nil
	}
	if runtime.GOOS == "windows" {
		return c.setupWindows()
	}
	return c.setupUnix()
}
431313
func (d *LSM303) setup() error {
	d.mu.RLock()
	if d.initialized {
		d.mu.RUnlock()
		return nil
	}
	d.mu.RUnlock()

	d.mu.Lock()
	defer d.mu.Unlock()

	if err := d.Bus.WriteByteToReg(magAddress, magConfigRegA, MagCRADefault); err != nil {
		return err
	}
	if err := d.Bus.WriteByteToReg(magAddress, magModeReg, MagMRDefault); err != nil {
		return err
	}

	d.initialized = true

	return nil
}
621153
func (b *storageosMounter) SetUp(fsGroup *int64) error {
	// Need a namespace to find the volume, try pod's namespace if not set.
	if b.volNamespace == "" {
		klog.V(2).Infof("Setting StorageOS volume namespace to pod namespace: %s", b.podNamespace)
		b.volNamespace = b.podNamespace
	}

	targetPath := makeGlobalPDName(b.plugin.host, b.pvName, b.volNamespace, b.volName)

	// Attach the device to the host.
	if err := b.manager.AttachDevice(b, targetPath); err != nil {
		klog.Errorf("Failed to attach device at %s: %s", targetPath, err.Error())
		return err
	}

	// Attach the StorageOS volume as a block device
	devicePath, err := b.manager.AttachVolume(b)
	if err != nil {
		klog.Errorf("Failed to attach StorageOS volume %s: %s", b.volName, err.Error())
		return err
	}

	// Mount the loop device into the plugin's disk global mount dir.
	err = b.manager.MountVolume(b, devicePath, targetPath)
	if err != nil {
		return err
	}
	klog.V(4).Infof("Successfully mounted StorageOS volume %s into global mount directory", b.volName)

	// Bind mount the volume into the pod
	return b.SetUpAt(b.GetPath(), fsGroup)
}
829295
func (b *portworxVolumeMounter) SetUp(fsGroup *int64) error {
	return b.SetUpAt(b.GetPath(), fsGroup)
}
1156915
func Setup(podRoot string, podID types.UUID, fps []commonnet.ForwardedPort, netList common.NetList, localConfig, flavor string, noDNS, debug bool) (*Networking, error) {

	stderr = log.New(os.Stderr, "networking", debug)
	debuglog = debug

	if flavor == "kvm" {
		return kvmSetup(podRoot, podID, fps, netList, localConfig, noDNS)
	}

	// TODO(jonboulle): currently podRoot is _always_ ".", and behaviour in other
	// circumstances is untested. This should be cleaned up.
	n := Networking{
		podEnv: podEnv{
			podRoot:      podRoot,
			podID:        podID,
			netsLoadList: netList,
			localConfig:  localConfig,
		},
	}

	err := n.mountNetnsDirectory()
	if err != nil {
		return nil, err
	}

	// Create the network namespace (and save its name in a file)
	err = n.podNSCreate()
	if err != nil {
		return nil, err
	}

	n.nets, err = n.loadNets()
	if err != nil {
		return nil, errwrap.Wrap(errors.New("error loading network definitions"), err)
	}

	if err := n.setupNets(n.nets, noDNS); err != nil {
		return nil, err
	}

	if len(fps) > 0 {
		if err = n.enableDefaultLocalnetRouting(); err != nil {
			return nil, err
		}
		podIP, err := n.GetForwardableNetPodIP()
		if err != nil {
			return nil, err
		}
		if err := n.setupForwarding(); err != nil {
			n.teardownForwarding()
			return nil, err
		}
		if err := n.forwardPorts(fps, podIP); err != nil {
			n.teardownForwarding()
			return nil, err
		}
	}

	// Switch to the podNS
	if err := n.podNS.Set(); err != nil {
		return nil, err
	}

	if err = loUp(); err != nil {
		return nil, err
	}

	return &n, nil
}
622084
func Setup(c *caddy.Controller) error {
	config, err := cacheParse(c)

	if err != nil {
		return err
	}

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return NewHandler(next, config)
	})

	c.OnStartup(func() error {
		if config.Path == "" {
			return nil
		}
		return os.MkdirAll(config.Path, 0600)
	})

	return nil
}
741109
func (consumer *Consumer) Setup(sarama.ConsumerGroupSession) error {
	// Mark the consumer as ready
	close(consumer.ready)
	return nil
}
313688
func Setup(allowPrivileged bool, privilegedSources PrivilegedSources, perConnectionBytesPerSec int64) {
	Initialize(Capabilities{
		AllowPrivileged:                        allowPrivileged,
		PrivilegedSources:                      privilegedSources,
		PerConnectionBandwidthLimitBytesPerSec: perConnectionBytesPerSec,
	})
}
537891
func Setup(nonce Nonce, key Key) (Key, *[16]byte) {
	// We use XSalsa20 for encryption so first we need to generate a
	// key and nonce with HSalsa20.
	var hNonce [16]byte
	copy(hNonce[:], nonce[:])
	var subKey [32]byte
	salsa.HSalsa20(&subKey, &hNonce, key, &salsa.Sigma)

	// The final 8 bytes of the original nonce form the new nonce.
	var counter [16]byte
	copy(counter[:], nonce[16:])
	return &subKey, &counter
}