mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-01 08:41:21 +00:00
81ea5bab78
* Initial commit * Add sentry gRPC interface * p2psentry directory * Update README.md * Update README.md * Update README.md * Add go package * Correct syntax * add external downloader interface (#2) * Add txpool (#3) * Add private API (#4) * Invert control.proto, add PeerMinBlock, Separare incoming Tx message into a separate stream (#5) Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> * Separate upload messages into its own stream (#6) Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> * Only send changed accounts to listeners (#7) * Txpool interface doc (#9) * More additions * More additions * Fix locking * Intermediate * Fix separation of phases * Intermediate * Fix test * More transformations * New simplified way of downloading headers * Fix hard-coded header sync * Fixed syncing near the tip of the chain * Add architecture diagram source and picture (#10) * More fixes * rename tip to link * Use preverified hashes instead of preverified headers * Fix preverified hashes generation * more parametrisation * Continue parametrisation * Fix grpc data limit, interruption of headers stage * Add ropsten preverified hashes * Typed hashes (#11) * Typed hashes * Fix PeerId * 64-bit tx nonce * Disable penalties * Add goerli settings, bootstrap nodes * Try to fix goerly sync * Remove interfaces * Add proper golang packages, max_block into p2p sentry Status * Prepare for proto overhaul * Squashed 'interfaces/' content from commit ce36053c2 git-subtree-dir: interfaces git-subtree-split: ce36053c24db2f56e48ac752808de60afa1dfb4b * Change EtherReply to address * Adaptations to new types * Switch to new types * Fixes * Fix formatting * Fix lint * Lint fixes, reverse order in types * Fix lint * Fix lint * Fix lint * Fix test * Not supporting eth/66 yet * Fix shutdown * Fix lint * Fix lint * Fix lint * return stopped check Co-authored-by: Artem Vorotnikov <artem@vorotnikov.me> Co-authored-by: b00ris <b00ris@mail.ru> Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com> Co-authored-by: canepat <16927169+canepat@users.noreply.github.com>
42 lines
948 B
Go
42 lines
948 B
Go
package remotedbserver
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/ethdb"
|
|
"github.com/ledgerwatch/turbo-geth/gointerfaces/remote"
|
|
)
|
|
|
|
type DBServer struct {
|
|
remote.UnimplementedDBServer // must be embedded to have forward compatible implementations.
|
|
|
|
kv ethdb.KV
|
|
}
|
|
|
|
func NewDBServer(kv ethdb.KV) *DBServer {
|
|
return &DBServer{kv: kv}
|
|
}
|
|
|
|
func (s *DBServer) Size(ctx context.Context, in *remote.SizeRequest) (*remote.SizeReply, error) {
|
|
sz, err := s.kv.(ethdb.HasStats).DiskSize(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &remote.SizeReply{Size: sz}, nil
|
|
}
|
|
|
|
func (s *DBServer) BucketSize(ctx context.Context, in *remote.BucketSizeRequest) (*remote.BucketSizeReply, error) {
|
|
out := &remote.BucketSizeReply{}
|
|
if err := s.kv.View(ctx, func(tx ethdb.Tx) error {
|
|
sz, err := tx.BucketSize(in.BucketName)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
out.Size = sz
|
|
return nil
|
|
}); err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|