// sets a value at the given unmodified index and returns the modified index of the value
332785
func (r *Ring) set(p int, v interface{}) {
	r.buff[r.mod(p)] = v
}
888956
func (c *CacheMemDB) Set(index *Index) error {
	if index == nil {
		return errors.New("nil index provided")
	}

	txn := c.db.Txn(true)
	defer txn.Abort()

	if err := txn.Insert(tableNameIndexer, index); err != nil {
		return fmt.Errorf("unable to insert index into cache: %v", err)
	}

	txn.Commit()

	return nil
}
718944
func (s *BatchWriteOperation) SetCreateIndex(v *BatchCreateIndex) *BatchWriteOperation {
	s.CreateIndex = v
	return s
}
178962
func (i *Int) Set(value int) {
	i.lock.Lock()
	defer i.lock.Unlock()
	i.increment = value
}
1211660
func (s *DetachFromIndexInput) SetIndexReference(v *ObjectReference) *DetachFromIndexInput {
	s.IndexReference = v
	return s
}
421302
func (o *Object) AddToIndex(indexName string, indexValue string) {
	if o.Indexes == nil {
		o.Indexes = make(map[string][]string)
	}
	if o.Indexes[indexName] == nil {
		o.Indexes[indexName] = make([]string, 1)
		o.Indexes[indexName][0] = indexValue
	} else {
		o.Indexes[indexName] = append(o.Indexes[indexName], indexValue)
	}
}
1102513
func (s *Settings) SetIfChanged(c context.Context, key string, value interface{}, who, why string) error {
	// 'value' must be a pointer to a struct. Construct a zero value of this
	// kind of struct.
	typ := reflect.TypeOf(value)
	if typ.Kind() != reflect.Ptr || typ.Elem().Kind() != reflect.Struct {
		return ErrBadType
	}
	existing := reflect.New(typ.Elem()).Interface()

	// Fetch existing settings and compare.
	switch err := s.GetUncached(c, key, existing); {
	case err != nil && err != ErrNoSettings:
		return err
	case reflect.DeepEqual(existing, value):
		return nil
	}

	// Log the change. Ignore JSON marshaling errors, they are not essential
	// (and must not happen anyway).
	existingJSON, _ := json.Marshal(existing)
	modifiedJSON, _ := json.Marshal(value)
	logging.Warningf(c, "Settings %q changed from %s to %s by %q", key, existingJSON, modifiedJSON, who)

	return s.Set(c, key, value, who, why)
}
672911
func (s *HeadObjectInput) SetIfUnmodifiedSince(v time.Time) *HeadObjectInput {
	s.IfUnmodifiedSince = &v
	return s
}
939850
func (idx *IndexMap) SetIndexType(indtype string) *IndexMap {
	idx.IndexType = indtype
	return idx
}
895407
func setIndex(resp http.ResponseWriter, index uint64) {
	resp.Header().Set("X-Nomad-Index", strconv.FormatUint(index, 10))
}
748725
func (query Query) Set(field string, value interface{}) Query {
	if query.Changes == nil {
		query.Changes = make(map[string]interface{})
	}

	query.Changes[field] = value
	return query
}
902340
func (ds *distanceSet) Set(index int, distance float64) bool {
	if d, ok := ds.Distances[index]; ok && index == ds.MinIndex && distance > d {
		// minimum index is being made greater, need to reset
		ds.Distances[index] = distance
		ds.reset()
		return true
	}

	ds.Distances[index] = distance
	if distance < ds.MinDistance {
		ds.MinDistance = distance
		ds.MinIndex = index
		return true
	}

	return false
}
1173101
func (s *Cluster) SetModifyStatus(v string) *Cluster {
	s.ModifyStatus = &v
	return s
}
925671
func (c *keyValueChanger) SetValue(value interface{}) (interface{}, error) {
	if c.err != nil {
		return nil, c.err
	}
	current := c.node.content.value()
	c.node.content = keyValue{c.node.content.key(), value}
	return current, nil
}
514126
func (s *BatchDetectEntitiesItemResult) SetIndex(v int64) *BatchDetectEntitiesItemResult {
	s.Index = &v
	return s
}
1082325
func (s *BatchReadSuccessfulResponse) SetListIndex(v *BatchListIndexResponse) *BatchReadSuccessfulResponse {
	s.ListIndex = v
	return s
}
848978
func (s *ListIndexInput) SetIndexReference(v *ObjectReference) *ListIndexInput {
	s.IndexReference = v
	return s
}