mirror of https://github.com/poanetwork/gecko.git
34 lines
958 B
Go
34 lines
958 B
Go
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
// For ease of implementation, our database's interface matches Ethereum's
|
|
// database implementation. This was to allow use to use Geth code as is for the
|
|
// EVM chain.
|
|
|
|
package database
|
|
|
|
// Batch is a write-only database that commits changes to its host database
|
|
// when Write is called. A batch cannot be used concurrently.
|
|
type Batch interface {
|
|
KeyValueWriter
|
|
|
|
// ValueSize retrieves the amount of data queued up for writing.
|
|
ValueSize() int
|
|
|
|
// Write flushes any accumulated data to disk.
|
|
Write() error
|
|
|
|
// Reset resets the batch for reuse.
|
|
Reset()
|
|
|
|
// Replay replays the batch contents.
|
|
Replay(w KeyValueWriter) error
|
|
}
|
|
|
|
// Batcher wraps the NewBatch method of a backing data store.
|
|
type Batcher interface {
|
|
// NewBatch creates a write-only database that buffers changes to its host db
|
|
// until a final write is called.
|
|
NewBatch() Batch
|
|
}
|