app

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: MIT Imports: 10 Imported by: 1

Documentation

Overview

Package app implements a TCP AppProxy which resides inside Babble and connects to the other side of the proxy.

Index

Constants

View Source
const DefaultProxyTimeout = time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type SocketAppProxy

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

SocketAppProxy is the Babble side of the socket AppProxy which communicates with the application via remote procedure calls (RPC) over TCP.

func NewSocketAppProxy

func NewSocketAppProxy(clientAddr string,
	bindAddr string,
	timeout time.Duration,
	logger *logrus.Entry) (*SocketAppProxy, error)

NewSocketAppProxy creates a new SocketAppProxy that uses RPC over TCP to communicate with the app. The clientAddr parameter corresponds to the remote address that the AppProxy connects to. The bindAddr parameter corresponds to the localAddr that the AppProxy listens on.

func (*SocketAppProxy) CommitBlock

func (p *SocketAppProxy) CommitBlock(block hashgraph.Block) (proxy.CommitResponse, error)

CommitBlock implements the AppProxy interface.

func (*SocketAppProxy) GetSnapshot

func (p *SocketAppProxy) GetSnapshot(blockIndex int) ([]byte, error)

GetSnapshot implements the AppProxy interface.

func (*SocketAppProxy) OnStateChanged added in v0.8.0

func (p *SocketAppProxy) OnStateChanged(state state.State) error

OnStateChanged implements the AppProxy interface.

func (*SocketAppProxy) Restore

func (p *SocketAppProxy) Restore(snapshot []byte) error

Restore implements the AppProxy interface.

func (*SocketAppProxy) SubmitCh

func (p *SocketAppProxy) SubmitCh() chan []byte

SubmitCh implements the AppProxy interface.

type SocketAppProxyClient

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

SocketAppProxyClient is the component of the AppProxy that sends RPC requests to the App

func NewSocketAppProxyClient

func NewSocketAppProxyClient(clientAddr string, timeout time.Duration, logger *logrus.Entry) *SocketAppProxyClient

NewSocketAppProxyClient creates a new SocketAppProxyClient

func (*SocketAppProxyClient) CommitBlock

func (p *SocketAppProxyClient) CommitBlock(block hashgraph.Block) (proxy.CommitResponse, error)

CommitBlock implements the AppProxy interface

func (*SocketAppProxyClient) GetSnapshot

func (p *SocketAppProxyClient) GetSnapshot(blockIndex int) ([]byte, error)

GetSnapshot implementes the AppProxy interface

func (*SocketAppProxyClient) OnStateChanged added in v0.8.0

func (p *SocketAppProxyClient) OnStateChanged(state state.State) error

OnStateChanged implements the AppProxy interface

func (*SocketAppProxyClient) Restore

func (p *SocketAppProxyClient) Restore(snapshot []byte) error

Restore implements the AppProxy interface

type SocketAppProxyServer

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

SocketAppProxyServer is the server component of the AppProxy that responds to RPC requests from App.

func NewSocketAppProxyServer

func NewSocketAppProxyServer(bindAddress string, logger *logrus.Entry) (*SocketAppProxyServer, error)

NewSocketAppProxyServer creates a new SocketAppProxyServer

func (*SocketAppProxyServer) SubmitTx

func (p *SocketAppProxyServer) SubmitTx(tx []byte, ack *bool) error

SubmitTx Implements the AppProxy interface

Jump to

Keyboard shortcuts

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