forked from cerc-io/plugeth
ethdb/remotedb, cmd: add support for remote (readonly) databases (#24836)
* ethdb/remotedb, cmd: add support for remote (readonly) databases * ethdb/remotedb: minor changes * ethdb/remotedb: close the conn * cmd, ethdb: add rpc accessor for ancient data * internal/ethapi: license * ethdb/remotedb: linter fixes
This commit is contained in:
@@ -1959,15 +1959,6 @@ func (api *PrivateDebugAPI) SetHead(number hexutil.Uint64) {
|
||||
api.b.SetHead(uint64(number))
|
||||
}
|
||||
|
||||
// DbGet returns the raw value of a key stored in the database.
|
||||
func (api *PrivateDebugAPI) DbGet(key string) (hexutil.Bytes, error) {
|
||||
blob, err := common.ParseHexOrString(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return api.b.ChainDb().Get(blob)
|
||||
}
|
||||
|
||||
// PublicNetAPI offers network related RPC methods
|
||||
type PublicNetAPI struct {
|
||||
net *p2p.Server
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright 2022 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package ethapi
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
)
|
||||
|
||||
// DbGet returns the raw value of a key stored in the database.
|
||||
func (api *PrivateDebugAPI) DbGet(key string) (hexutil.Bytes, error) {
|
||||
blob, err := common.ParseHexOrString(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return api.b.ChainDb().Get(blob)
|
||||
}
|
||||
|
||||
// DbAncient retrieves an ancient binary blob from the append-only immutable files.
|
||||
// It is a mapping to the `AncientReaderOp.Ancient` method
|
||||
func (api *PrivateDebugAPI) DbAncient(kind string, number uint64) (hexutil.Bytes, error) {
|
||||
return api.b.ChainDb().Ancient(kind, number)
|
||||
}
|
||||
|
||||
// DbAncients returns the ancient item numbers in the ancient store.
|
||||
// It is a mapping to the `AncientReaderOp.Ancients` method
|
||||
func (api *PrivateDebugAPI) DbAncients() (uint64, error) {
|
||||
return api.b.ChainDb().Ancients()
|
||||
}
|
||||
Reference in New Issue
Block a user