node

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2020 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppLogger            = "app"
	P2PLogger            = "p2p"
	PostLogger           = "post"
	StateDbLogger        = "stateDbStore"
	StateLogger          = "state"
	AtxDbStoreLogger     = "atxDbStore"
	PoetDbStoreLogger    = "poetDbStore"
	StoreLogger          = "store"
	PoetDbLogger         = "poetDb"
	MeshDBLogger         = "meshDb"
	TrtlLogger           = "trtl"
	AtxDbLogger          = "atxDb"
	BlkEligibilityLogger = "blkElgValidator"
	MeshLogger           = "mesh"
	SyncLogger           = "sync"
	BlockOracle          = "blockOracle"
	HareBeaconLogger     = "hareBeacon"
	HareOracleLogger     = "hareOracle"
	HareLogger           = "hare"
	BlockBuilderLogger   = "blockBuilder"
	BlockListenerLogger  = "blockListener"
	PoetListenerLogger   = "poetListener"
	NipstBuilderLogger   = "nipstBuilder"
	AtxBuilderLogger     = "atxBuilder"
)

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "node",
	Short: "start node",
	Run: func(cmd *cobra.Command, args []string) {
		app := NewSpacemeshApp()
		defer app.Cleanup(cmd, args)

		app.Initialize(cmd, args)
		app.Start(cmd, args)
	},
}
View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Show version info",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Print(cmdp.Version)
		if cmdp.Commit != "" {
			fmt.Printf("+%s", cmdp.Commit)
		}
		fmt.Println()
	},
}

VersionCmd returns the current version of spacemesh

Functions

func ActivateGrpcServer

func ActivateGrpcServer(smApp *SpacemeshApp)

ActivateGrpcServer starts a grpc server on the provided node

func GracefulShutdown

func GracefulShutdown(apps []*SpacemeshApp)

GracefulShutdown stops the current services running in apps

func LoadConfigFromFile

func LoadConfigFromFile() (*cfg.Config, error)

func StartMultiNode

func StartMultiNode(numOfinstances, layerAvgSize int, runTillLayer uint32, dbPath string)

Starts the run of a number of nodes, running in process consensus between them. this also runs a single transaction between the nodes.

Types

type HareService

type HareService interface {
	Service
	GetResult(id types.LayerID) ([]types.BlockID, error)
}

type ManualClock

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

func NewManualClock

func NewManualClock(genesisTime time.Time) *ManualClock

func (*ManualClock) AwaitLayer

func (t *ManualClock) AwaitLayer(layerId types.LayerID) chan struct{}

func (ManualClock) Close

func (t ManualClock) Close()

func (ManualClock) GetCurrentLayer

func (t ManualClock) GetCurrentLayer() types.LayerID

func (ManualClock) GetGenesisTime

func (t ManualClock) GetGenesisTime() time.Time

func (ManualClock) LayerToTime added in v0.1.6

func (lc ManualClock) LayerToTime(id types.LayerID) time.Time

LayerToTime returns the time of the provided layer

func (*ManualClock) StartNotifying

func (t *ManualClock) StartNotifying()

func (*ManualClock) Subscribe

func (t *ManualClock) Subscribe() timesync.LayerTimer

func (*ManualClock) Tick

func (t *ManualClock) Tick()

func (*ManualClock) Unsubscribe

func (t *ManualClock) Unsubscribe(ch timesync.LayerTimer)

type Network

type Network interface {
	NewNode() *service.Node
}

type Service

type Service interface {
	Start() error
	Close()
}

type SpacemeshApp

type SpacemeshApp struct {
	*cobra.Command

	P2P    p2p.Service
	Config *cfg.Config
	// contains filtered or unexported fields
}

SpacemeshApp is the cli app singleton

func InitSingleInstance

func InitSingleInstance(cfg config.Config, i int, genesisTime string, rng *amcl.RAND, storePath string, rolacle *eligibility.FixedRolacle, poetClient *activation.HTTPPoetClient, fastHare bool, clock TickProvider, net Network) (*SpacemeshApp, error)

InitSingleInstance initializes a node instance with given configuration and parameters, it does not stop the instance.

func NewSpacemeshApp

func NewSpacemeshApp() *SpacemeshApp

NewSpacemeshApp creates an instance of the spacemesh app

func (*SpacemeshApp) Cleanup

func (app *SpacemeshApp) Cleanup(cmd *cobra.Command, args []string) (err error)

Post Execute tasks

func (*SpacemeshApp) HareFactory

func (app *SpacemeshApp) HareFactory(mdb *mesh.MeshDB, swarm service.Service, sgn hare.Signer, nodeID types.NodeId, syncer *sync.Syncer, msh *mesh.Mesh, hOracle hare.Rolacle, idStore *activation.IdentityStore, clock TickProvider, lg log.Log) HareService

func (*SpacemeshApp) Initialize

func (app *SpacemeshApp) Initialize(cmd *cobra.Command, args []string) (err error)

this is what he wants to execute Initialize app starts this is my persistent pre run that involves parsing the toml config file

func (*SpacemeshApp) LoadOrCreateEdSigner

func (app *SpacemeshApp) LoadOrCreateEdSigner() (*signing.EdSigner, error)

func (*SpacemeshApp) ParseConfig

func (app *SpacemeshApp) ParseConfig() error

ParseConfig unmarshal config file into struct

func (*SpacemeshApp) SetLogLevel

func (app *SpacemeshApp) SetLogLevel(name, loglevel string) error

func (*SpacemeshApp) Start

func (app *SpacemeshApp) Start(cmd *cobra.Command, args []string)

type TickProvider

type TickProvider interface {
	Subscribe() timesync.LayerTimer
	Unsubscribe(timer timesync.LayerTimer)
	GetCurrentLayer() types.LayerID
	StartNotifying()
	GetGenesisTime() time.Time
	LayerToTime(id types.LayerID) time.Time
	Close()
	AwaitLayer(layerId types.LayerID) chan struct{}
}

Jump to

Keyboard shortcuts

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