// Set stores content by checksum.
972657
func (s *fs) Set(data []byte) (digest.Digest, error) {
	s.Lock()
	defer s.Unlock()

	if len(data) == 0 {
		return "", fmt.Errorf("invalid empty data")
	}

	dgst := digest.FromBytes(data)
	if err := ioutils.AtomicWriteFile(s.contentFile(dgst), data, 0600); err != nil {
		return "", errors.Wrap(err, "failed to write digest data")
	}

	return dgst, nil
}
35520
func (m *MDBStore) Set(key []byte, val []byte) error {
	// Start write txn
	tx, dbis, err := m.startTxn(false, dbConf)
	if err != nil {
		return err
	}

	if err := tx.Put(dbis[0], key, val, 0); err != nil {
		tx.Abort()
		return err
	}
	return tx.Commit()
}
1253138
func (b *BytesRefBuilder) Set(offset int, v byte) {
	b.ref.Bytes[offset] = v
}
985941
func (u *URI) Set(value string) error {
	uri, err := NewURIFromAddress(value)
	if err != nil {
		return err
	}
	*u = *uri
	return nil
}
278253
func (m *Map) Set(k []byte, v MapValue) {
	m.set(k, v, mapKeyOptions{
		copyKey:     true,
		finalizeKey: m.finalize != nil,
	})
}
542344
func (m Map) Set(key, value string) {
	m[key] = []string{value}
}
1040626
func (c standardConfigManager) Set(key string, value []byte) error {
	err := c.store.Set(key, value)
	return err
}
72953
func (m *MemoryStore) Set(name string, meta []byte) error {
	m.data[name] = meta

	parsedMeta := &data.SignedMeta{}
	err := json.Unmarshal(meta, parsedMeta)
	if err == nil {
		// no parse error means this is metadata and not a key, so store by version
		version := parsedMeta.Signed.Version
		versionedName := fmt.Sprintf("%d.%s", version, name)
		m.data[versionedName] = meta
	}

	checksum := sha256.Sum256(meta)
	path := utils.ConsistentName(name, checksum[:])
	m.consistent[path] = meta
	return nil
}
681473
func (f *Int64Slice) Set(value string) error {
	tmp, err := strconv.ParseInt(value, 10, 64)
	if err != nil {
		return err
	}
	*f = append(*f, tmp)
	return nil
}
1056457
func (m *SyncMap) Set(key string, value interface{}) {
	shard := m.locate(key)
	shard.Lock()
	shard.items[key] = value
	shard.Unlock()
}
608096
func (s *Setter) Set(addr chunk.Address) (err error) {
	return s.db.set(s.mode, addr)
}
365766
func (s *redisStorage) Set(key string, val interface{}, expires time.Duration) error {
	item := &cachedItem{Val: val}
	value, err := encodeGob(item)
	if err != nil {
		return err
	}

	status := s.c.SetEx(key, expires, string(value))
	return status.Err()
}
35975
func (s Uint64Slice) Set(v uint64) {
	for i := range s {
		s[i] = v
	}
}
1001125
func (c *MemoryCache) Set(key string, resp []byte) {
	c.mu.Lock()
	c.items[key] = resp
	c.mu.Unlock()
}
189054
func (cache *Cache) Set(key string, image *imageserver.Image, params imageserver.Params) error {
	item := &item{
		image: image,
	}
	cache.lru.Set(key, item)
	return nil
}
125734
func (v *String) Set(value string) {
	v.mu.Lock()
	v.s = value
	v.mu.Unlock()
}
1022603
func (m *DiskCacheMode) Set(s string) error {
	*m = DiskCacheModeOff
	switch strings.ToLower(strings.TrimSpace(s)) {
	case "local":
		*m = DiskCacheModeLocal
	case "remote":
		*m = DiskCacheModeRemote
	}
	return nil
}