// add() try to mount the volume and add it to the sandbox
480981
func (v *Volume) add() error {
	changed, err := v.transit(
		S_VOLUME_INSERTING,
		map[VolumeState]bool{S_VOLUME_CREATED: true},                            // from created to inserting
		map[VolumeState]bool{S_VOLUME_INSERTING: true, S_VOLUME_INSERTED: true}, //ignore if inserting or inserted already
	)
	if !changed { // already logged in v.transit method
		return err
	}

	defer func() {
		if err != nil {
			v.setInsertFail(err)
		}
	}()

	err = v.mount()
	if err != nil {
		v.Log(ERROR, "failed to mount volume: %v", err)
		return err
	}
	defer func() {
		if err != nil {
			v.umount()
		}
	}()

	err = v.insert()
	if err != nil {
		v.Log(ERROR, "failed to mount volume: %v", err)
		return err
	}

	//only from inserting to inserted
	v.setInserted()
	return nil
}
647666
func (a *AudioSystem) Add(basic *ecs.BasicEntity, audio *AudioComponent) {
	a.entities = append(a.entities, audioEntity{basic, audio})
}
786314
func addStorages(ctx context.Context, storages []*pb.Storage, s *sandbox) ([]string, error) {
	span, ctx := trace(ctx, "mount", "addStorages")
	span.SetTag("sandbox", s.id)
	defer span.Finish()

	var mountList []string

	for _, storage := range storages {
		if storage == nil {
			continue
		}

		devHandler, ok := storageHandlerList[storage.Driver]
		if !ok {
			return nil, grpcStatus.Errorf(codes.InvalidArgument,
				"Unknown storage driver %q", storage.Driver)
		}

		// Wrap the span around the handler call to avoid modifying
		// the handler interface but also to avoid having to add trace
		// code to each driver.
		handlerSpan, _ := trace(ctx, "mount", storage.Driver)
		mountPoint, err := devHandler(*storage, s)
		handlerSpan.Finish()

		if err != nil {
			return nil, err
		}

		if mountPoint != "" {
			// Prepend mount point to mount list.
			mountList = append([]string{mountPoint}, mountList...)
		}
	}

	return mountList, nil
}
1350251
func (as *AttributeSource) Add(s string) Attribute {
	attImpl, ok := as.attributes[s]
	if !ok {
		attImpl = as.factory.Create(s)
		as.AddImpl(attImpl)
	}
	return attImpl
}
106969
func (d *driver) Attach(
	ctx types.Context,
	volumeName string,
	opts *types.VolumeAttachOpts) (string, error) {
	return "", nil
}
582902
func (h Headers) Add(k, v string) Headers {
	r := append(h, k, v)
	return r
}
679987
func (sm *ScriptMap) Add(scriptName string, script *Script) {
	sm.lock.Lock()
	defer sm.lock.Unlock()
	sm.scripts[scriptName] = script
}
1201245
func (e *SimpleEventHandler) Add(s string) {
	e.items = append(e.items, s)
	e.levels = append(e.levels, e.current)
}
451659
func (b *Base) Add(key string, value interface{}) Serializer {
	return b.AddIf(alwaysTrue, key, value)
}
235431
func (g *Noop) Add(ctx context.Context, args ...string) error {
	return nil
}
981868
func (f *Files) Add(filename string, size int64, modtime time.Time, o Opener) {
	f.lk.Lock()
	defer f.lk.Unlock()

	r, err := o.Open()
	if err != nil {
		log.Printf("Could not add file %v: %v", filename, err)
		return
	}
	contents, err := ioutil.ReadAll(r)
	if err != nil {
		log.Printf("Could not read contents of file %v: %v", filename, err)
		return
	}

	f.add(filename, &staticFile{
		name:     filename,
		contents: contents,
		modtime:  modtime,
	})
}
1356449
func (f *Files) add(filename string, sf *staticFile) {
	if f.file == nil {
		f.file = make(map[string]*staticFile)
	}
	f.file[filename] = sf
}
221782
func (s *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronograf.Source, error) {
	return s.AddF(ctx, src)
}
560769
func (r *ListenerRegistry) Add(key interface{}, listener func()) {
	if key == nil {
		key = new(int)
	}
	if _, ok := r.listeners[key]; ok {
		panic("duplicate listener key")
	}
	r.listeners[key] = listener
}
811298
func (c *Client) Add(uri string) error {
	return c.Command("add %s", uri).OK()
}
536889
func (m *errorManager) Add(e ErrorContainer) {
	m.errors = append(m.errors, e)
}
1207575
func (r *configs) Add(configs ...api.Config) {
	r.mu.Lock()
	defer r.mu.Unlock()
	for _, config := range configs {
		r.m[config.ID] = config.Copy()
	}
}