Compare commits
32
Commits
tests
...
release-v1.1.12
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8950625d7 | ||
|
|
0abadf55e0 | ||
|
|
2f12715789 | ||
|
|
e2432b7c97 | ||
|
|
93baf6bc09 | ||
|
|
88d7dabca6 | ||
|
|
ab847166c4 | ||
|
|
473d62b873 | ||
|
|
ca40c021c3 | ||
|
|
b4326045df | ||
|
|
6da0b8b3ab | ||
|
|
d9e5a06648 | ||
|
|
f48d787667 | ||
|
|
4d84121b50 | ||
|
|
5dedfb5168 | ||
|
|
6906429b6d | ||
|
|
33959f60d1 | ||
|
|
884b06adf9 | ||
|
|
8b6985a110 | ||
|
|
1fbe0605f6 | ||
|
|
f0c9cf78b5 | ||
|
|
cf23cf8d21 | ||
|
|
33d85c81a7 | ||
|
|
1d795c4a56 | ||
|
|
0a5d3bf5ec | ||
|
|
ff4f8d9115 | ||
|
|
4d985768cc | ||
|
|
ccb15240e1 | ||
|
|
50a5617c25 | ||
|
|
09fcf2aa60 | ||
|
|
12bb0d5dfc | ||
|
|
b55cc1989c |
@@ -0,0 +1,29 @@
|
||||
name: Notion Sync
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
issues:
|
||||
types:
|
||||
[
|
||||
opened,
|
||||
edited,
|
||||
labeled,
|
||||
unlabeled,
|
||||
assigned,
|
||||
unassigned,
|
||||
milestoned,
|
||||
demilestoned,
|
||||
reopened,
|
||||
closed,
|
||||
]
|
||||
|
||||
jobs:
|
||||
notion_job:
|
||||
runs-on: ubuntu-latest
|
||||
name: Add GitHub Issues to Notion
|
||||
steps:
|
||||
- name: Add GitHub Issues to Notion
|
||||
uses: vulcanize/notion-github-action@v1.2.4-issueid
|
||||
with:
|
||||
notion-token: ${{ secrets.NOTION_TOKEN }}
|
||||
notion-db: ${{ secrets.NOTION_DATABASE }}
|
||||
@@ -1,2 +1,3 @@
|
||||
.idea/
|
||||
leveldb-ethdb-rpc
|
||||
environments/config.toml
|
||||
|
||||
@@ -1,2 +1,26 @@
|
||||
# leveldb-ethdb-rpc
|
||||
Thin RPC wrapper around LevelDB to expose data remotely
|
||||
|
||||
## Setup
|
||||
|
||||
Run the following
|
||||
|
||||
```bash
|
||||
make build
|
||||
```
|
||||
|
||||
Create a `config.toml` file from [example.toml](./environments/example.toml) file.
|
||||
|
||||
Update the config for path to geth leveldb and geth ancient database
|
||||
|
||||
```toml
|
||||
[leveldb]
|
||||
path = "/path/to/eth/data/geth/chaindata" # $LEVELDB_PATH
|
||||
ancient = "/path/to/eth/data/geth/chaindata/ancient" # $LEVELDB_ANCIENT_PATH
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
After building the binary, run as
|
||||
|
||||
`./leveldb-ethdb-rpc serve --config ./environments/config.toml`
|
||||
|
||||
+6
-1
@@ -20,7 +20,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
leveldb_ethdb_rpc "github.com/vulcanize/leveldb-ethdb-rpc/pkg"
|
||||
leveldb_ethdb_rpc "github.com/cerc-io/leveldb-ethdb-rpc/pkg"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -79,6 +79,11 @@ func logLevel() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
cobra.OnInitialize(initConfig)
|
||||
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file location")
|
||||
}
|
||||
|
||||
// initConfig reads in config file and ENV variables if set.
|
||||
func initConfig() {
|
||||
if cfgFile != "" {
|
||||
|
||||
+3
-3
@@ -26,9 +26,9 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
leveldb_ethdb_rpc "github.com/vulcanize/leveldb-ethdb-rpc/pkg"
|
||||
srpc "github.com/vulcanize/leveldb-ethdb-rpc/pkg/rpc"
|
||||
"github.com/vulcanize/leveldb-ethdb-rpc/version"
|
||||
leveldb_ethdb_rpc "github.com/cerc-io/leveldb-ethdb-rpc/pkg"
|
||||
srpc "github.com/cerc-io/leveldb-ethdb-rpc/pkg/rpc"
|
||||
"github.com/cerc-io/leveldb-ethdb-rpc/version"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -1,21 +1,141 @@
|
||||
module github.com/vulcanize/leveldb-ethdb-rpc
|
||||
module github.com/cerc-io/leveldb-ethdb-rpc
|
||||
|
||||
go 1.16
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/btcsuite/btcd v0.22.0-beta // indirect
|
||||
github.com/ethereum/go-ethereum v1.10.14
|
||||
github.com/go-kit/kit v0.10.0 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
||||
github.com/julienschmidt/httprouter v1.3.0 // indirect
|
||||
github.com/onsi/ginkgo v1.16.5 // indirect
|
||||
github.com/onsi/gomega v1.13.0 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/shirou/gopsutil v3.21.5+incompatible // indirect
|
||||
github.com/sirupsen/logrus v1.7.0
|
||||
github.com/ethereum/go-ethereum v1.11.4
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
github.com/spf13/cobra v1.1.1
|
||||
github.com/spf13/viper v1.10.1
|
||||
github.com/tklauser/go-sysconf v0.3.6 // indirect
|
||||
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/DataDog/zstd v1.5.2 // indirect
|
||||
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/cockroachdb/errors v1.9.1 // indirect
|
||||
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
|
||||
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect
|
||||
github.com/cockroachdb/redact v1.1.3 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
||||
github.com/deepmap/oapi-codegen v1.8.2 // indirect
|
||||
github.com/edsrzf/mmap-go v1.0.0 // indirect
|
||||
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
|
||||
github.com/georgysavva/scany v1.2.1 // indirect
|
||||
github.com/getsentry/sentry-go v0.17.0 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/go-stack/stack v1.8.1 // indirect
|
||||
github.com/gofrs/flock v0.8.1 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.3.0 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/gorilla/websocket v1.4.2 // indirect
|
||||
github.com/graph-gophers/graphql-go v1.3.0 // indirect
|
||||
github.com/hashicorp/go-bexpr v0.1.10 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
|
||||
github.com/holiman/uint256 v1.2.0 // indirect
|
||||
github.com/huin/goupnp v1.0.3 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/influxdata/influxdb v1.8.3 // indirect
|
||||
github.com/influxdata/influxdb-client-go/v2 v2.4.0 // indirect
|
||||
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
|
||||
github.com/ipfs/bbloom v0.0.4 // indirect
|
||||
github.com/ipfs/go-block-format v0.0.3 // indirect
|
||||
github.com/ipfs/go-cid v0.2.0 // indirect
|
||||
github.com/ipfs/go-datastore v0.5.0 // indirect
|
||||
github.com/ipfs/go-ipfs-blockstore v1.2.0 // indirect
|
||||
github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect
|
||||
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
|
||||
github.com/ipfs/go-ipld-format v0.4.0 // indirect
|
||||
github.com/ipfs/go-log v0.0.1 // indirect
|
||||
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
|
||||
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
|
||||
github.com/jackc/pgconn v1.10.0 // indirect
|
||||
github.com/jackc/pgio v1.0.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
|
||||
github.com/jackc/pgtype v1.8.1 // indirect
|
||||
github.com/jackc/pgx/v4 v4.13.0 // indirect
|
||||
github.com/jackc/puddle v1.1.3 // indirect
|
||||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
||||
github.com/jbenet/goprocess v0.1.4 // indirect
|
||||
github.com/jmoiron/sqlx v1.3.5 // indirect
|
||||
github.com/klauspost/compress v1.15.15 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/lib/pq v1.10.7 // indirect
|
||||
github.com/magiconair/properties v1.8.5 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.16 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
|
||||
github.com/minio/sha256-simd v1.0.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.4.3 // indirect
|
||||
github.com/mitchellh/pointerstructure v1.2.0 // indirect
|
||||
github.com/mr-tron/base58 v1.2.0 // indirect
|
||||
github.com/multiformats/go-base32 v0.0.3 // indirect
|
||||
github.com/multiformats/go-base36 v0.1.0 // indirect
|
||||
github.com/multiformats/go-multibase v0.0.3 // indirect
|
||||
github.com/multiformats/go-multihash v0.1.0 // indirect
|
||||
github.com/multiformats/go-varint v0.0.6 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/pelletier/go-toml v1.9.4 // indirect
|
||||
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 // indirect
|
||||
github.com/pganalyze/pg_query_go/v2 v2.2.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/prometheus/client_golang v1.14.0 // indirect
|
||||
github.com/prometheus/client_model v0.3.0 // indirect
|
||||
github.com/prometheus/common v0.37.1 // indirect
|
||||
github.com/prometheus/procfs v0.9.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.9.0 // indirect
|
||||
github.com/rs/cors v1.7.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/afero v1.6.0 // indirect
|
||||
github.com/spf13/cast v1.4.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/status-im/keycard-go v0.2.0 // indirect
|
||||
github.com/stretchr/objx v0.4.0 // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
|
||||
github.com/thoas/go-funk v0.9.3 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.11 // indirect
|
||||
github.com/tklauser/numcpus v0.6.0 // indirect
|
||||
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
|
||||
github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa // indirect
|
||||
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc // indirect
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.2 // indirect
|
||||
go.uber.org/atomic v1.6.0 // indirect
|
||||
golang.org/x/crypto v0.6.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect
|
||||
golang.org/x/net v0.6.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
lukechampine.com/blake3 v1.1.6 // indirect
|
||||
)
|
||||
|
||||
replace github.com/ethereum/go-ethereum v1.11.4 => github.com/cerc-io/go-ethereum v1.11.4-statediff-4.3.8-alpha
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package main
|
||||
|
||||
import "github.com/vulcanize/leveldb-ethdb-rpc/cmd"
|
||||
import "github.com/cerc-io/leveldb-ethdb-rpc/cmd"
|
||||
|
||||
func main() {
|
||||
cmd.Execute()
|
||||
|
||||
@@ -19,8 +19,6 @@ package leveldb_ethdb_rpc
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
)
|
||||
|
||||
// APIName is the namespace used for the state diffing service API
|
||||
@@ -61,10 +59,6 @@ func (s *PublicLevelDBAPI) AncientRange(ctx context.Context, kind string, start,
|
||||
return s.b.AncientRange(kind, start, count, maxBytes)
|
||||
}
|
||||
|
||||
func (s *PublicLevelDBAPI) ReadAncients(fn func(ethdb.AncientReader) error) error {
|
||||
return s.b.ReadAncients(fn)
|
||||
}
|
||||
|
||||
func (s *PublicLevelDBAPI) Ancients(ctx context.Context) (uint64, error) {
|
||||
return s.b.Ancients()
|
||||
}
|
||||
|
||||
+33
-1
@@ -17,11 +17,14 @@
|
||||
package leveldb_ethdb_rpc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/ethdb/leveldb"
|
||||
)
|
||||
|
||||
var errNotSupported = errors.New("this operation is not supported")
|
||||
var _ ethdb.Database = &LevelDBBackend{}
|
||||
|
||||
// NewLevelDBBackend creates a new levelDB RPC server backend
|
||||
@@ -66,7 +69,7 @@ func (s *LevelDBBackend) AncientRange(kind string, start, count, maxBytes uint64
|
||||
return s.ethDB.AncientRange(kind, start, count, maxBytes)
|
||||
}
|
||||
|
||||
func (s *LevelDBBackend) ReadAncients(fn func(ethdb.AncientReader) error) error {
|
||||
func (s *LevelDBBackend) ReadAncients(fn func(ethdb.AncientReaderOp) error) error {
|
||||
return s.ethDB.ReadAncients(fn)
|
||||
}
|
||||
|
||||
@@ -74,6 +77,10 @@ func (s *LevelDBBackend) Ancients() (uint64, error) {
|
||||
return s.ethDB.Ancients()
|
||||
}
|
||||
|
||||
func (s *LevelDBBackend) Tail() (uint64, error) {
|
||||
return s.ethDB.Tail()
|
||||
}
|
||||
|
||||
func (s *LevelDBBackend) AncientSize(kind string) (uint64, error) {
|
||||
return s.ethDB.AncientSize(kind)
|
||||
}
|
||||
@@ -94,6 +101,14 @@ func (s *LevelDBBackend) TruncateAncients(n uint64) error {
|
||||
return errWriteNotAllowed
|
||||
}
|
||||
|
||||
func (s *LevelDBBackend) TruncateHead(n uint64) error {
|
||||
return errWriteNotAllowed
|
||||
}
|
||||
|
||||
func (s *LevelDBBackend) TruncateTail(n uint64) error {
|
||||
return errWriteNotAllowed
|
||||
}
|
||||
|
||||
func (s *LevelDBBackend) Sync() error {
|
||||
return errWriteNotAllowed
|
||||
}
|
||||
@@ -102,6 +117,10 @@ func (s *LevelDBBackend) NewBatch() ethdb.Batch {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *LevelDBBackend) NewBatchWithSize(size int) ethdb.Batch {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *LevelDBBackend) NewIterator(_ []byte, _ []byte) ethdb.Iterator {
|
||||
return nil
|
||||
}
|
||||
@@ -117,3 +136,16 @@ func (s *LevelDBBackend) Compact(_ []byte, _ []byte) error {
|
||||
func (s *LevelDBBackend) Close() error {
|
||||
return errWriteNotAllowed
|
||||
}
|
||||
|
||||
func (s *LevelDBBackend) MigrateTable(string, func([]byte) ([]byte, error)) error {
|
||||
return errWriteNotAllowed
|
||||
}
|
||||
|
||||
func (s *LevelDBBackend) NewSnapshot() (ethdb.Snapshot, error) {
|
||||
return s.ethDB.NewSnapshot()
|
||||
}
|
||||
|
||||
// AncientDatadir returns an error as we don't have a backing chain freezer.
|
||||
func (d *LevelDBBackend) AncientDatadir() (string, error) {
|
||||
return "", errNotSupported
|
||||
}
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
// Copyright © 2022 Vulcanize, Inc
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
)
|
||||
|
||||
var errNotSupported = errors.New("this operation is not supported")
|
||||
|
||||
var _ ethdb.Database = &DatabaseClient{}
|
||||
|
||||
// Type that satisfies the ethdb.DatabaseClient using a leveldb-ethdb-rpc client
|
||||
type DatabaseClient struct {
|
||||
client *rpc.Client
|
||||
}
|
||||
|
||||
// NewDatabase returns a ethdb.Database interface
|
||||
func NewDatabaseClient(url string) (ethdb.Database, error) {
|
||||
rpcClient, err := rpc.Dial(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
database := DatabaseClient{
|
||||
client: rpcClient,
|
||||
}
|
||||
|
||||
return &database, nil
|
||||
}
|
||||
|
||||
// Has satisfies the ethdb.KeyValueReader interface
|
||||
// Has retrieves if a key is present in the key-value data store
|
||||
func (d *DatabaseClient) Has(key []byte) (bool, error) {
|
||||
var resp bool
|
||||
err := d.client.Call(&resp, "leveldb_has", key)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Get satisfies the ethdb.KeyValueReader interface
|
||||
// Get retrieves the given key if it's present in the key-value data store
|
||||
func (d *DatabaseClient) Get(key []byte) ([]byte, error) {
|
||||
var resp []byte
|
||||
err := d.client.Call(&resp, "leveldb_get", key)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Put satisfies the ethdb.KeyValueWriter interface
|
||||
// Put inserts the given value into the key-value data store
|
||||
// Key is expected to be the keccak256 hash of value
|
||||
func (d *DatabaseClient) Put(key []byte, value []byte) error {
|
||||
return errNotSupported
|
||||
}
|
||||
|
||||
// Delete satisfies the ethdb.KeyValueWriter interface
|
||||
// Delete removes the key from the key-value data store
|
||||
func (d *DatabaseClient) Delete(key []byte) error {
|
||||
return errNotSupported
|
||||
}
|
||||
|
||||
// Stat satisfies the ethdb.Stater interface
|
||||
// Stat returns a particular internal stat of the database
|
||||
func (d *DatabaseClient) Stat(property string) (string, error) {
|
||||
var resp string
|
||||
err := d.client.Call(&resp, "leveldb_stat", property)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Compact satisfies the ethdb.Compacter interface
|
||||
// Compact flattens the underlying data store for the given key range
|
||||
func (d *DatabaseClient) Compact(start []byte, limit []byte) error {
|
||||
return errNotSupported
|
||||
}
|
||||
|
||||
// NewBatch satisfies the ethdb.Batcher interface
|
||||
// NewBatch creates a write-only database that buffers changes to its host db
|
||||
// until a final write is called
|
||||
func (d *DatabaseClient) NewBatch() ethdb.Batch {
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewBatchWithSize satisfies the ethdb.Batcher interface.
|
||||
// NewBatchWithSize creates a write-only database batch with pre-allocated buffer.
|
||||
func (d *DatabaseClient) NewBatchWithSize(size int) ethdb.Batch {
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewIterator satisfies the ethdb.Iteratee interface
|
||||
// it creates a binary-alphabetical iterator over a subset
|
||||
// of database content with a particular key prefix, starting at a particular
|
||||
// initial key (or after, if it does not exist).
|
||||
//
|
||||
// Note: This method assumes that the prefix is NOT part of the start, so there's
|
||||
// no need for the caller to prepend the prefix to the start
|
||||
func (d *DatabaseClient) NewIterator(prefix []byte, start []byte) ethdb.Iterator {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close satisfies the io.Closer interface
|
||||
// Close closes the db connection
|
||||
func (d *DatabaseClient) Close() error {
|
||||
return errNotSupported
|
||||
}
|
||||
|
||||
// HasAncient satisfies the ethdb.AncientReader interface
|
||||
// HasAncient returns an indicator whether the specified data exists in the ancient store
|
||||
func (d *DatabaseClient) HasAncient(kind string, number uint64) (bool, error) {
|
||||
var resp bool
|
||||
err := d.client.Call(&resp, "leveldb_hasAncient", kind, number)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Ancient satisfies the ethdb.AncientReader interface
|
||||
// Ancient retrieves an ancient binary blob from the append-only immutable files
|
||||
func (d *DatabaseClient) Ancient(kind string, number uint64) ([]byte, error) {
|
||||
var resp []byte
|
||||
err := d.client.Call(&resp, "leveldb_ancient", kind, number)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Ancients satisfies the ethdb.AncientReader interface
|
||||
// Ancients returns the ancient item numbers in the ancient store
|
||||
func (d *DatabaseClient) Ancients() (uint64, error) {
|
||||
var resp uint64
|
||||
err := d.client.Call(&resp, "leveldb_ancients")
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Tail satisfies the ethdb.AncientReader interface.
|
||||
// Tail returns the number of first stored item in the freezer.
|
||||
func (d *DatabaseClient) Tail() (uint64, error) {
|
||||
return 0, errNotSupported
|
||||
}
|
||||
|
||||
// AncientSize satisfies the ethdb.AncientReader interface
|
||||
// AncientSize returns the ancient size of the specified category
|
||||
func (d *DatabaseClient) AncientSize(kind string) (uint64, error) {
|
||||
var resp uint64
|
||||
err := d.client.Call(&resp, "leveldb_ancientSize")
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// AncientRange retrieves all the items in a range, starting from the index 'start'.
|
||||
// It will return
|
||||
// - at most 'count' items,
|
||||
// - at least 1 item (even if exceeding the maxBytes), but will otherwise
|
||||
// return as many items as fit into maxBytes.
|
||||
func (d *DatabaseClient) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error) {
|
||||
var resp [][]byte
|
||||
err := d.client.Call(&resp, "leveldb_ancientRange", kind, start, count, maxBytes)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ReadAncients applies the provided AncientReader function
|
||||
func (d *DatabaseClient) ReadAncients(fn func(ethdb.AncientReaderOp) error) (err error) {
|
||||
return fn(d)
|
||||
}
|
||||
|
||||
// ModifyAncients satisfies the ethdb.AncientWriter interface.
|
||||
// ModifyAncients runs a write operation on the ancient store.
|
||||
func (d *DatabaseClient) ModifyAncients(f func(ethdb.AncientWriteOp) error) (int64, error) {
|
||||
return 0, errNotSupported
|
||||
}
|
||||
|
||||
// TruncateHead satisfies the ethdb.AncientWriter interface.
|
||||
// TruncateHead discards all but the first n ancient data from the ancient store.
|
||||
func (d *DatabaseClient) TruncateHead(n uint64) error {
|
||||
return errNotSupported
|
||||
}
|
||||
|
||||
// TruncateTail satisfies the ethdb.AncientWriter interface.
|
||||
// TruncateTail discards the first n ancient data from the ancient store.
|
||||
func (d *DatabaseClient) TruncateTail(n uint64) error {
|
||||
return errNotSupported
|
||||
}
|
||||
|
||||
// Sync satisfies the ethdb.AncientWriter interface
|
||||
// Sync flushes all in-memory ancient store data to disk
|
||||
func (d *DatabaseClient) Sync() error {
|
||||
return errNotSupported
|
||||
}
|
||||
|
||||
// MigrateTable satisfies the ethdb.AncientWriter interface.
|
||||
// MigrateTable processes and migrates entries of a given table to a new format.
|
||||
func (d *DatabaseClient) MigrateTable(string, func([]byte) ([]byte, error)) error {
|
||||
return errNotSupported
|
||||
}
|
||||
|
||||
// NewSnapshot satisfies the ethdb.Snapshotter interface.
|
||||
// NewSnapshot creates a database snapshot based on the current state.
|
||||
func (d *DatabaseClient) NewSnapshot() (ethdb.Snapshot, error) {
|
||||
return nil, errNotSupported
|
||||
}
|
||||
|
||||
// AncientDatadir returns an error as we don't have a backing chain freezer.
|
||||
func (d *DatabaseClient) AncientDatadir() (string, error) {
|
||||
return "", errNotSupported
|
||||
}
|
||||
+2
-2
@@ -29,11 +29,11 @@ import (
|
||||
func StartHTTPEndpoint(endpoint string, apis []rpc.API, modules []string, cors []string, vhosts []string, timeouts rpc.HTTPTimeouts) (*rpc.Server, error) {
|
||||
|
||||
srv := rpc.NewServer()
|
||||
err := node.RegisterApis(apis, modules, srv, false)
|
||||
err := node.RegisterApis(apis, modules, srv)
|
||||
if err != nil {
|
||||
utils.Fatalf("Could not register HTTP API: %w", err)
|
||||
}
|
||||
handler := node.NewHTTPHandlerStack(srv, cors, vhosts)
|
||||
handler := node.NewHTTPHandlerStack(srv, cors, vhosts, nil)
|
||||
|
||||
// start http server
|
||||
_, addr, err := node.StartHTTPEndpoint(endpoint, rpc.DefaultHTTPTimeouts, handler)
|
||||
|
||||
Reference in New Issue
Block a user