// Add creates a new annotation in the store
486016
func (a *AnnotationStore) Add(ctx context.Context, anno *chronograf.Annotation) (*chronograf.Annotation, error) {
	var err error
	anno.ID, err = a.id.Generate()
	if err != nil {
		return nil, err
	}
	return anno, a.client.Write(ctx, []chronograf.Point{
		toPoint(anno, a.now()),
	})
}
173145
func (store *KapacitorStore) Add(ctx context.Context, kap chronograf.Server) (chronograf.Server, error) {
	return chronograf.Server{}, fmt.Errorf("in-memory KapacitorStore does not support adding a Kapacitor")
}
582114
func (c *ServiceConfigs) Add(name string, service *ServiceConfig) {
	c.mu.Lock()
	c.m[name] = service
	c.mu.Unlock()
}
410582
func (c *Container) Add(w io.Writer) error {
	if w == nil {
		return errors.New("参数w不能为一个空值")
	}

	c.ws = append(c.ws, w)
	return nil
}
1211869
func Add(name string, value interface{}, tags ...Tag) {
	DefaultEngine.Add(name, value, tags...)
}
44566
func (s *SourcesStore) Add(ctx context.Context, d chronograf.Source) (chronograf.Source, error) {
	err := validOrganization(ctx)
	if err != nil {
		return chronograf.Source{}, err
	}

	d.Organization = s.organization
	return s.store.Add(ctx, d)
}
908259
func (s *nodeStore) Add(n *api.Node, expireFunc func()) *registeredNode {
	s.mu.Lock()
	defer s.mu.Unlock()
	var attempts int
	var registered time.Time
	if existRn, ok := s.nodes[n.ID]; ok {
		attempts = existRn.Attempts
		registered = existRn.Registered
		existRn.Heartbeat.Stop()
		delete(s.nodes, n.ID)
	}
	if registered.IsZero() {
		registered = time.Now()
	}
	rn := &registeredNode{
		SessionID:  identity.NewID(), // session ID is local to the dispatcher.
		Node:       n,
		Registered: registered,
		Attempts:   attempts,
		Disconnect: make(chan struct{}),
	}
	s.nodes[n.ID] = rn
	rn.Heartbeat = heartbeat.New(s.periodChooser.Choose()*s.gracePeriodMultiplierNormal, expireFunc)
	return rn
}
850911
func (c *changer) Add(v interface{}) error {
	if c.err != nil {
		return c.err
	}
	_, err := c.node.addChild(justValue{v})
	return err
}
914685
func (we *WorkflowExecutor) AddAnnotation(key, value string) error {
	return common.AddPodAnnotation(we.ClientSet, we.PodName, we.Namespace, key, value)
}
1162793
func (s *Store) Add(name string, entities ...[]rune) {
	s.Lock()
	g, ok := s.groups[name]
	if !ok {
		g = &group{
			name:     name,
			entities: make(map[string][][]rune, DefaultGroupSize),
		}
		s.groups[name] = g
	}
	s.Unlock()

	g.Lock()
	for _, e := range entities {
		h := hash([]rune(e))
		g.entities[h] = append(g.entities[h], e)
		if len(e) > g.maxLen {
			g.maxLen = len(e)
		}
	}
	g.Unlock()
}
329416
func (s layeredStorage) Add(r io.Reader, m Metadata) error {
	return s[0].Add(r, m)
}
419653
func (h *HelperMap) Add(key string, helper interface{}) error {
	h.moot.Lock()
	defer h.moot.Unlock()
	if h.helpers == nil {
		h.helpers = map[string]interface{}{}
	}
	err := h.validateHelper(key, helper)
	if err != nil {
		return errors.WithStack(err)
	}
	h.helpers[key] = helper
	return nil
}
540340
func add(b *Builder, args []string, attributes map[string]bool, flagArgs []string, original string) error {
	if len(args) < 2 {
		return errAtLeastOneArgument("ADD")
	}
	var chown string
	last := len(args) - 1
	dest := makeAbsolute(args[last], b.RunConfig.WorkingDir)
	if len(flagArgs) > 0 {
		for _, arg := range flagArgs {
			switch {
			case strings.HasPrefix(arg, "--chown="):
				chown = strings.TrimPrefix(arg, "--chown=")
			default:
				return fmt.Errorf("ADD only supports the --chown=<uid:gid> flag")
			}
		}
	}
	b.PendingCopies = append(b.PendingCopies, Copy{Src: args[0:last], Dest: dest, Download: true, Chown: chown})
	return nil
}
709014
func (e *Store) Add(id string, Config *Config) {
	e.Lock()
	e.byID[id] = Config
	e.Unlock()
}
1168013
func (s *WaitingProofStore) Add(proof *WaitingProof) error {
	s.mu.Lock()
	defer s.mu.Unlock()

	err := s.db.Update(func(tx *bbolt.Tx) error {
		var err error
		var b bytes.Buffer

		// Get or create the bucket.
		bucket, err := tx.CreateBucketIfNotExists(waitingProofsBucketKey)
		if err != nil {
			return err
		}

		// Encode the objects and place it in the bucket.
		if err := proof.Encode(&b); err != nil {
			return err
		}

		key := proof.Key()

		return bucket.Put(key[:], b.Bytes())
	})
	if err != nil {
		return err
	}

	// Knowing that the write succeeded, we can now update the in-memory
	// cache with the proof's key.
	s.cache[proof.Key()] = struct{}{}

	return nil
}
984781
func (s *store) Add(key string, data interface{}) int {
	s.count++
	return s.root.add(key, data, s.count)
}
1311279
func (multi *KapacitorStore) Add(ctx context.Context, kap chronograf.Server) (chronograf.Server, error) {
	var err error
	for _, store := range multi.Stores {
		var k chronograf.Server
		k, err = store.Add(ctx, kap)
		if err == nil {
			return k, nil
		}
	}
	return chronograf.Server{}, nil
}