mobile

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2020 License: MIT Imports: 15 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/mosaicnetworks/babble/src/mobile

Import the Babble 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

func GetPrivPublKeys

func GetPrivPublKeys() string

GetPrivPublKeys ...

Types

type CommitHandler

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

CommitHandler ...

type ExceptionHandler

type ExceptionHandler interface {
	OnException(string)
}

ExceptionHandler ...

type MobileConfig

type MobileConfig struct {
	Heartbeat      int    //heartbeat timeout in milliseconds
	SlowHeartbeat  int    //slow-heartbeat 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
	EnableFastSync bool   //Enable fast sync
	Store          bool   //Use badger store
	LogLevel       string //debug, info, warn, error, fatal, panic
	DatabaseDir    string //path to BadgerDB
	Bootstrap      bool   // Bootstrap node
	Moniker        string //optional name
	SuspendLimit   int    //number of undetermined-events before suspension
}

MobileConfig is shortly to be deprecated. It was used to pass mobile configuration parameters from android (/ other OS) to babble. It will be replaced by the load config options included above

func DefaultMobileConfig

func DefaultMobileConfig() *MobileConfig

DefaultMobileConfig ...

func NewMobileConfig

func NewMobileConfig(heartbeat int,
	slowHeartbeat int,
	tcpTimeout int,
	maxPool int,
	cacheSize int,
	syncLimit int,
	enableFastSync bool,
	store bool,
	logLevel string,
	databaseDir string,
	bootstrap bool,
	moniker string,
	suspendLimit int) *MobileConfig

NewMobileConfig ...

type Node

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

Node is the object that mobile consumers interact with.

func New

func New(
	commitHandler CommitHandler,
	exceptionHandler ExceptionHandler,
	configDir string,
) *Node

New initializes Node struct

func (*Node) GetGenesisPeers added in v0.6.0

func (n *Node) GetGenesisPeers() string

GetGenesisPeers returns the genesis peers.

func (*Node) GetPeers added in v0.4.1

func (n *Node) GetPeers() string

GetPeers returns the current list of peers.

func (*Node) GetStats added in v0.5.0

func (n *Node) GetStats() string

GetStats returns consensus stats.

func (*Node) Leave added in v0.5.0

func (n *Node) Leave()

Leave instructs the node to leave politely (get removed from validator-set) before shutting down.

func (*Node) Run

func (n *Node) Run(async bool)

Run runs the Babble node

func (*Node) Shutdown

func (n *Node) Shutdown()

Shutdown shutsdown the node without requesting to be removed from the validator-set

func (*Node) SubmitTx

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

SubmitTx submits a transaction to Babble for consensus ordering.

Jump to

Keyboard shortcuts

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