// AddMulti sends multiple ADDJOB in pipeline
322347
func (c *RedisClient) AddMulti(rs []AddRequest) ([]string, error) {
	for _, r := range rs {
		if err := c.conn.Send("ADDJOB", addArgs(r)...); err != nil {
			return nil, err
		}
	}
	// flush the output buffer and receive pending replies
	replies, err := redis.Values(c.conn.Do(""))
	ids := make([]string, len(replies))
	for i, val := range replies {
		if id, ok := val.(string); ok {
			ids[i] = id
		}
	}
	return ids, err
}
558806
func AddCommon(mx *web.Mux) {
	mx.Use(middleware.EnvInit)
	mx.Use(RequestID)
	mx.Use(middleware.RealIP)
}
575022
func (s *ListJobsInput) SetMultiNodeJobId(v string) *ListJobsInput {
	s.MultiNodeJobId = &v
	return s
}
136785
func (sm *SyncMultiError) Append(err error) {
	sm.Lock()
	defer sm.Unlock()
	sm.MultiError = append(sm.MultiError, err)
}
889825
func (b *multiErrBuilder) Add(err error) {
	if err != nil {
		b.errs = append(b.errs, err)
	}
}
606475
func (b *CumulativeBucket) MultiAdd(res *Result) {
	if res.Count == 0 {
		return
	}
	atomic.AddInt64(&b.count, res.Count)
	atomic.AddInt64(&b.sum, res.Sum)
	b.sumOfSquares.Add(res.SumOfSquares)
}
1357608
func (ins Inputs) MulAdd(mul, add Input) Input {
	ia := make([]Input, len(ins))
	for i, in := range ins {
		ia[i] = in.MulAdd(mul, add)
	}
	return Inputs(ia)
}
658348
func (f *Flag) IsMulti() bool {
	if f.value.Kind() == reflect.Slice {
		return true
	}
	return false
}
285078
func addMultiMutator(shardClient Client, mapping *ShardMapping) []MutateResponse {
	return shardClient.AddMulti(mapping.Items)
}
670493
func (s *CacheOnStorage) SetMulti(items ...interface{}) error {
	if err := s.storage.SetMulti(items...); err != nil {
		return err
	}

	return s.cache.SetMulti(items...)
}
1232227
func (s *CacheOnStorage) DeleteMulti(keys ...interface{}) error {
	if err := s.storage.DeleteMulti(keys...); err != nil {
		return err
	}

	return s.cache.DeleteMulti(keys...)
}
250423
func SignMulti(payload []byte, options ...Option) ([]byte, error) {
	var signers []PayloadSigner
	for _, o := range options {
		switch o.Name() {
		case optkeyPayloadSigner:
			signers = append(signers, o.Value().(PayloadSigner))
		}
	}

	if len(signers) == 0 {
		return nil, errors.New(`no signers provided`)
	}

	var result EncodedMessage

	result.Payload = base64.RawURLEncoding.EncodeToString(payload)

	for _, signer := range signers {
		protected := signer.ProtectedHeader()
		if protected == nil {
			protected = &StandardHeaders{}
		}

		protected.Set(AlgorithmKey, signer.Algorithm())

		hdrbuf, err := json.Marshal(protected)
		if err != nil {
			return nil, errors.Wrap(err, `failed to marshal headers`)
		}
		encodedHeader := base64.RawURLEncoding.EncodeToString(hdrbuf)
		var buf bytes.Buffer
		buf.WriteString(encodedHeader)
		buf.WriteByte('.')
		buf.WriteString(result.Payload)
		signature, err := signer.Sign(buf.Bytes())
		if err != nil {
			return nil, errors.Wrap(err, `failed to sign payload`)
		}

		result.Signatures = append(result.Signatures, &EncodedSignature{
			Headers:   signer.PublicHeader(),
			Protected: encodedHeader,
			Signature: base64.RawURLEncoding.EncodeToString(signature),
		})
	}

	return json.Marshal(result)
}
249830
func (c *Client) AddMultisigAddress(requiredSigs int, addresses []btcutil.Address, account string) (btcutil.Address, error) {
	return c.AddMultisigAddressAsync(requiredSigs, addresses,
		account).Receive()
}
1144016
func (c *RawBinaryClient) DeleteMulti(keys []string) []MutateResponse {
	if keys == nil {
		return nil
	}

	responses := make([]MutateResponse, len(keys), len(keys))

	c.mutex.Lock()
	defer c.mutex.Unlock()

	for i, key := range keys {
		responses[i] = c.sendDeleteRequest(key)
	}

	for i, key := range keys {
		if responses[i] != nil { // error occurred while sending
			continue
		}
		responses[i] = c.receiveMutateResponse(opDelete, key)
	}

	return responses
}
400025
func (b *CumulativeBucket) Add(val int64) {
	r := &Result{}
	r.Add(val)
	b.MultiAdd(r)
}
522057
func (m *MemoryStore) SetMulti(metas map[string][]byte) error {
	for role, blob := range metas {
		m.Set(role, blob)
	}
	return nil
}
1110359
func PutMulti(c context.Context, keys []*datastore.Key, dst interface{}) error {

	f := datastore.PutMulti
	if len(keys) > 0 {
		f = getPutMultiFunc(keys[0].Kind())
	}

	forEach(dst, func(index int, elem interface{}) error {
		if ht, ok := elem.(HasTime); ok {
			ht.SetMetaTime()
		}
		if hv, ok := elem.(HasVersion); ok {
			hv.IncrementVersion()
		}
		return nil
	})

	keysput, err := f(c, keys, dst)
	if err != nil {
		if _, ok := err.(appengine.MultiError); !ok {
			return errors.WrapOr(err)
		}
	}

	forEach(dst, func(index int, elem interface{}) error {
		if hk, ok := elem.(HasKey); ok {
			hk.SetKey(keysput[index])
		}
		return nil
	})

	if err != nil {
		return errors.WrapOr(err)
	}

	return nil
}