rpc

package
v0.0.0-...-ea7b605 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package rpc implements an RPC client that connect to a centralized mock store. Centralazied mock store can be any other mock store implementation that is registered to Ethereum RPC server under mockStore name. Methods that defines mock.GlobalStore are the same that are used by RPC. Example:

server := rpc.NewServer()
server.RegisterName("mockStore", mem.NewGlobalStore())

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GlobalStore

type GlobalStore struct {
	// contains filtered or unexported fields
}

GlobalStore is rpc.Client that connects to a centralized mock store. Closing GlobalStore instance is required to release RPC client resources.

func NewGlobalStore

func NewGlobalStore(client *rpc.Client) *GlobalStore

NewGlobalStore creates a new instance of GlobalStore.

func (*GlobalStore) Close

func (s *GlobalStore) Close() error

Close closes RPC client.

func (*GlobalStore) Delete

func (s *GlobalStore) Delete(addr common.Address, key []byte) error

Delete calls a Delete method to RPC server.

func (*GlobalStore) Get

func (s *GlobalStore) Get(addr common.Address, key []byte) (data []byte, err error)

Get calls a Get method to RPC server.

func (*GlobalStore) HasKey

func (s *GlobalStore) HasKey(addr common.Address, key []byte) bool

HasKey calls a HasKey method to RPC server.

func (*GlobalStore) KeyNodes

func (s *GlobalStore) KeyNodes(key []byte, startAddr *common.Address, limit int) (nodes mock.Nodes, err error)

KeyNodes returns a paginated list of nodes that contain a particular key.

func (*GlobalStore) Keys

func (s *GlobalStore) Keys(startKey []byte, limit int) (keys mock.Keys, err error)

Keys returns a paginated list of keys on all nodes.

func (*GlobalStore) NewNodeStore

func (s *GlobalStore) NewNodeStore(addr common.Address) *mock.NodeStore

NewNodeStore returns a new instance of NodeStore that retrieves and stores chunk data only for a node with address addr.

func (*GlobalStore) NodeKeys

func (s *GlobalStore) NodeKeys(addr common.Address, startKey []byte, limit int) (keys mock.Keys, err error)

NodeKeys returns a paginated list of keys on a node with provided address.

func (*GlobalStore) Nodes

func (s *GlobalStore) Nodes(startAddr *common.Address, limit int) (nodes mock.Nodes, err error)

Nodes returns a paginated list of all known nodes.

func (*GlobalStore) Put

func (s *GlobalStore) Put(addr common.Address, key []byte, data []byte) error

Put calls a Put method to RPC server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL