func (l *LevelDBPersistence) Get(value coding.Encoder) (b []byte, err error) {
	key, err := value.Encode()
	if err != nil {
		return
	}

	return l.storage.Get(l.readOptions, key)
}
Exemple #2
0
func (b batch) Drop(key coding.Encoder) {
	keyEncoded, err := key.Encode()
	if err != nil {
		panic(err)
	}

	b.batch.Delete(keyEncoded)
}
func (l *LevelDBPersistence) Drop(value coding.Encoder) (err error) {
	key, err := value.Encode()
	if err != nil {
		return
	}

	err = l.storage.Delete(l.writeOptions, key)

	return
}
Exemple #4
0
func (b batch) Put(key, value coding.Encoder) {
	keyEncoded, err := key.Encode()
	if err != nil {
		panic(err)
	}
	valueEncoded, err := value.Encode()
	if err != nil {
		panic(err)
	}

	b.batch.Put(keyEncoded, valueEncoded)
}
func (l *LevelDBPersistence) Put(key, value coding.Encoder) (err error) {
	keyEncoded, err := key.Encode()
	if err != nil {
		return
	}

	valueEncoded, err := value.Encode()
	if err != nil {
		return
	}

	err = l.storage.Put(l.writeOptions, keyEncoded, valueEncoded)

	return
}