// Put stores a key in the Keystore, if a key with the same name already exists, returns ErrKeyExists
167469
func (ks *FSKeystore) Put(name string, k ci.PrivKey) error {
	if err := validateName(name); err != nil {
		return err
	}

	b, err := k.Bytes()
	if err != nil {
		return err
	}

	kp := filepath.Join(ks.dir, name)

	_, err = os.Stat(kp)
	if err == nil {
		return ErrKeyExists
	} else if !os.IsNotExist(err) {
		return err
	}

	fi, err := os.Create(kp)
	if err != nil {
		return err
	}
	defer fi.Close()

	_, err = fi.Write(b)

	return err
}
174351
func (kv *KV) Put(key, value []byte) error {
	return kv.db.Update(func(tx *buntdb.Tx) error {
		_, _, err := tx.Set(gkv.Btos(key), gkv.Btos(value), nil)
		return err
	})
}
959346
func (s *storeImpl) Put(ctx datastore.Context, properties *StoredProperties) error {
	return s.ds.Put(ctx, Key(propsID), properties)
}
1073308
func (t *table) Put(key []byte, value []byte) error {
	return t.db.Put(append([]byte(t.prefix), key...), value)
}
1316786
func (kv *KV) Put(key, value []byte) error {
	return kv.db.Put(key, value, nil)
}
1261000
func (batch *UpdateBatch) Put(key []byte, value []byte) {
	if value == nil {
		panic("Nil value not allowed")
	}
	batch.KVs[string(key)] = value
}
708943
func (s *Store) Put(id packet.ID, future *Future) {
	s.Lock()
	defer s.Unlock()

	s.store[id] = future
}
1013429
func (c *Client) Put(key string, value []byte, flags uint64) error {
	_, err := c.putCAS(key, value, flags, 0, false)
	return err
}
68225
func (s *storeImpl) Put(ctx datastore.Context, svc *Service) error {
	//No need to store ConfigFiles
	defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.Put"))
	svc.ConfigFiles = make(map[string]servicedefinition.ConfigFile)

	err := s.ds.Put(ctx, Key(svc.ID), svc)
	if err == nil {
		s.updateVolatileInfo(svc.ID, svc.DesiredState, svc.UpdatedAt) // Uses Mutex Lock
	}
	return err
}
1348698
func (c *Context) Put(key string, value interface{}) {
	c.lock.Lock()
	c.contextMap[key] = value
	c.lock.Unlock()
}
1243455
func (ng *etcdv2AutoCertCache) Put(ctx context.Context, rawKey string, data []byte) error {
	key := ng.normalized(rawKey)
	_, err := ng.kapi.Set(ctx, key, string(data), &etcd.SetOptions{})
	return err
}
1333253
func (b *FailBatch) Put(k ds.Key, val []byte) error {
	if err := b.dstore.errfunc("batch-put"); err != nil {
		return err
	}

	return b.cb.Put(k, val)
}
1341175
func (d *Datastore) Put(key ds.Key, value []byte) (err error) {
	fn := d.KeyFilename(key)

	// mkdirall above.
	err = os.MkdirAll(filepath.Dir(fn), 0755)
	if err != nil {
		return err
	}

	return ioutil.WriteFile(fn, value, 0666)
}
241218
func (rc *Redis) Put(key string, value interface{}) error {
	val, err := Encode(value)
	if err != nil {
		if rc.Debug {
			log.Println("[Redis]EncodeErr: ", err, "Key:", key)
		}
		return err
	}
	if _, err = rc.do("SETEX", key, rc.LifeTime, val); err != nil {
		return err
	}
	_, err = rc.do("HSET", rc.key, key, true)
	if err != nil {
		if rc.Debug {
			log.Println("[Redis]PutErr: ", err, "Key:", key)
		}
		return err
	}
	if rc.Debug {
		log.Println("[Redis]Put: ", key)
	}
	return err
}
729789
func (db *DB) Put(key []byte, value []byte) (err error) {
	err = db.ldb.Put(key, value, nil)
	if err != nil {
		metrics.GetOrRegisterCounter("DB.putFail", nil).Inc(1)
		return err
	}
	metrics.GetOrRegisterCounter("DB.put", nil).Inc(1)
	return nil
}
469814
func (d *LogDatastore) Put(key Key, value []byte) (err error) {
	log.Printf("%s: Put %s\n", d.Name, key)
	// log.Printf("%s: Put %s ```%s```", d.Name, key, value)
	return d.child.Put(key, value)
}
553911
func (s *storeImpl) Put(ctx datastore.Context, image *Image) error {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("ImageRegistryStore.Put"))
	return s.ds.Put(ctx, image.key(), image)
}