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 ¶
- type GlobalStore
- func (s *GlobalStore) Close() error
- func (s *GlobalStore) Delete(addr common.Address, key []byte) error
- func (s *GlobalStore) Get(addr common.Address, key []byte) (data []byte, err error)
- func (s *GlobalStore) HasKey(addr common.Address, key []byte) bool
- func (s *GlobalStore) KeyNodes(key []byte, startAddr *common.Address, limit int) (nodes mock.Nodes, err error)
- func (s *GlobalStore) Keys(startKey []byte, limit int) (keys mock.Keys, err error)
- func (s *GlobalStore) NewNodeStore(addr common.Address) *mock.NodeStore
- func (s *GlobalStore) NodeKeys(addr common.Address, startKey []byte, limit int) (keys mock.Keys, err error)
- func (s *GlobalStore) Nodes(startAddr *common.Address, limit int) (nodes mock.Nodes, err error)
- func (s *GlobalStore) Put(addr common.Address, key []byte, data []byte) error
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) Delete ¶
func (s *GlobalStore) Delete(addr common.Address, key []byte) error
Delete calls a Delete 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) 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.