mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
ethdb: Renamed DatabaseTable to Table
This commit is contained in:
parent
ede0dc68f6
commit
9372be985b
1 changed files with 14 additions and 14 deletions
|
|
@ -306,47 +306,47 @@ func (b *ldbBatch) Write() error {
|
||||||
return b.db.Write(b.b, nil)
|
return b.db.Write(b.b, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
type DatabaseTable struct {
|
type Table struct {
|
||||||
db Database
|
db Database
|
||||||
prefix string
|
prefix string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDatabaseTable(db Database, prefix string) *DatabaseTable {
|
func NewTable(db Database, prefix string) *Table {
|
||||||
return &DatabaseTable{
|
return &Table{
|
||||||
db: db,
|
db: db,
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dt *DatabaseTable) Put(key []byte, value []byte) error {
|
func (dt *Table) Put(key []byte, value []byte) error {
|
||||||
return dt.db.Put(append([]byte(dt.prefix), key...), value)
|
return dt.db.Put(append([]byte(dt.prefix), key...), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dt *DatabaseTable) Get(key []byte) ([]byte, error) {
|
func (dt *Table) Get(key []byte) ([]byte, error) {
|
||||||
return dt.db.Get(append([]byte(dt.prefix), key...))
|
return dt.db.Get(append([]byte(dt.prefix), key...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dt *DatabaseTable) Delete(key []byte) error {
|
func (dt *Table) Delete(key []byte) error {
|
||||||
return dt.db.Delete(append([]byte(dt.prefix), key...))
|
return dt.db.Delete(append([]byte(dt.prefix), key...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dt *DatabaseTable) Close() {
|
func (dt *Table) Close() {
|
||||||
// Do nothing; don't close the underlying DB.
|
// Do nothing; don't close the underlying DB.
|
||||||
}
|
}
|
||||||
|
|
||||||
type databaseTableBatch struct {
|
type tableBatch struct {
|
||||||
batch Batch
|
batch Batch
|
||||||
prefix string
|
prefix string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dt *DatabaseTable) NewBatch() Batch {
|
func (dt *Table) NewBatch() Batch {
|
||||||
return &databaseTableBatch{dt.db.NewBatch(), dt.prefix}
|
return &tableBatch{dt.db.NewBatch(), dt.prefix}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dtb *databaseTableBatch) Put(key, value []byte) error {
|
func (tb *tableBatch) Put(key, value []byte) error {
|
||||||
return dtb.batch.Put(append([]byte(dtb.prefix), key...), value)
|
return tb.batch.Put(append([]byte(tb.prefix), key...), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dtb *databaseTableBatch) Write() error {
|
func (tb *tableBatch) Write() error {
|
||||||
return dtb.batch.Write()
|
return tb.batch.Write()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue