Пример #1
0
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)
}
Пример #2
0
func (b batch) Drop(key coding.Encoder) {
	keyEncoded, err := key.Encode()
	if err != nil {
		panic(err)
	}

	b.batch.Delete(keyEncoded)
}
Пример #3
0
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
}
Пример #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)
}
Пример #5
0
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
}