mobile

package
v0.0.0-...-168a2c3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: MIT Imports: 9 Imported by: 0

README

Build from source

Dependencies

Java JDK, Android NDK, Go mobile tools

$ go get golang.org/x/mobile/cmd/gomobile
$ gomobile init -ndk ~/PATH/TO/ANDROID/NDK

Building android library

To compile Go package as android library execute

$ gomobile bind -v -target=android -tags=mobile github.com/Fantom-foundation/go-lachesis/mobile

Import the Lachesis Module

Follow Oliver's answer:
https://stackoverflow.com/questions/16682847/how-to-manually-include-external-aar-package-using-new-gradle-android-build-syst

Sometimes, Android Studio says “cannot resolve symbol” even if the project compiles. In this case, do the following:

"File" -> "Invalidate Caches..." -> "Invalidate and Restart"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitHandler

type CommitHandler interface {
	OnCommit([]byte) []byte
}

CommitHandler is called when Lachesis has committed a block to the DAG and publishes that message to the mobile app. It returns the state hash resulting from applying the block's transactions to the state.

type ExceptionHandler

type ExceptionHandler interface {
	OnException(string)
}

ExceptionHandler handles mobile app mobile app exceptions.

type MobileConfig

type MobileConfig struct {
	Heartbeat  int    //heartbeat timeout in milliseconds
	TCPTimeout int    //TCP timeout in milliseconds
	MaxPool    int    //Max number of pooled connections
	CacheSize  int    //Number of items in LRU cache
	SyncLimit  int    //Max Events per sync
	StoreType  string //inmem or badger
	StorePath  string //File containing the Store DB
}

MobileConfig stores all the configuration information for a mobile node

func DefaultMobileConfig

func DefaultMobileConfig() *MobileConfig

DefaultMobileConfig sets the default config

func NewMobileConfig

func NewMobileConfig(heartbeat int,
	tcpTimeout int,
	maxPool int,
	cacheSize int,
	syncLimit int,
	storeType string,
	storePath string) *MobileConfig

NewMobileConfig creates a new mobile config

type Node

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

Node struct

func New

func New(privKey string,
	nodeAddr string,
	participants *peers.Peers,
	commitHandler CommitHandler,
	exceptionHandler ExceptionHandler,
	config *MobileConfig) *Node

New initializes Node struct

func (*Node) Run

func (n *Node) Run(async bool)

Run the node (can be async)

func (*Node) Shutdown

func (n *Node) Shutdown()

Shutdown the node

func (*Node) SubmitTx

func (n *Node) SubmitTx(tx []byte)

SubmitTx submits the transaction

Jump to

Keyboard shortcuts

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