func (db *DB) Put(key []byte, value []byte) error {
	if len(key) > keySizeMax {
		return errKeySize
	}

	db.writeLock.Lock()
	defer db.writeLock.Unlock()

	seqNumber := db.getSeqNumber()
	ptr, err := db.writeRecordToFile(&Record{Key: key, Value: value, SeqNumber: seqNumber})
	oldInfo, updated := db.table.Update(key, &recordInfo{ptr: ptr, seqNumber: seqNumber})
	if !updated {
		panic("key has not been updated")
	}

	if oldInfo != nil {
		db.markPreviousAsStale(oldInfo.ptr.FileId, recordSize(len(key), int(oldInfo.ptr.valueSize)))
	}
	return err
}
// Associates the specified value with the specified key in this map (optional operation).
// If the map previously contained a mapping for the key, the old value is replaced by the specified value.
Associates the specified value with the specified key in this map (optional operation).
If the map previously contained a mapping for the key, the old value is replaced by the specified value.
// Associates the specified value with the specified key in this map ( optional operation ) . // If the map previously contained a mapping for the key the old value is replaced by the specified value .
func (db *DB) Put(key []byte, value []byte) error {
	if len(key) > keySizeMax {
		return errKeySize
	}
	db.writeLock.Lock()
	defer db.writeLock.Unlock()
	seqNumber := db.getSeqNumber()
	ptr, err := db.writeRecordToFile(&Record{Key: key, Value: value, SeqNumber: seqNumber})
	oldInfo, updated := db.table.Update(key, &recordInfo{ptr: ptr, seqNumber: seqNumber})
	if !updated {
		panic("key has not been updated")
	}
	if oldInfo != nil {
		db.markPreviousAsStale(oldInfo.ptr.FileId, recordSize(len(key), int(oldInfo.ptr.valueSize)))
	}
	return err
}
func ( db * DB ) Put ( key [ ] byte , value [ ] byte ) error { if len ( key ) > keySizeMax { return errKeySize } db . writeLock . Lock ( ) defer db . writeLock . Unlock ( ) seqNumber := db . getSeqNumber ( ) ptr , err := db . writeRecordToFile ( & Record { Key : key , Value : value , SeqNumber : seqNumber } ) oldInfo , updated := db . table . Update ( key , & recordInfo { ptr : ptr , seqNumber : seqNumber } ) if ! updated { panic ( " " ) } if oldInfo != nil { db . markPreviousAsStale ( oldInfo . ptr . FileId , recordSize ( len ( key ) , int ( oldInfo . ptr . valueSize ) ) ) } return err }
Associates the specified value with the specified key in this map (optional operation).
Associates the specified value with the specified key in this map ( optional operation ) .