ethereum

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	New TrackerState = iota
	BusyBroadcasting
	BroadcastSuccess
	BusyFinalizing
	Finalized
	Released

	BROADCASTING  string = "broadcasting"
	FINALIZING    string = "finalizing"
	FINALIZE      string = "finalize"
	MINTING       string = "minting"
	CLEANUP       string = "cleanup"
	SIGNING       string = "signing"
	VERIFYREDEEM  string = "verifyredeem"
	REDEEMCONFIRM string = "redeemconfirm"
	BURN          string = "burn"

	ProcessTypeNone   ProcessType = 0x00
	ProcessTypeLock   ProcessType = 0x01
	ProcessTypeRedeem ProcessType = 0x02
)

Variables

View Source
var (
	ErrTrackerNotFound = errors.New("tracker not found")
)

Functions

This section is empty.

Types

type ProcessType

type ProcessType int8

type Tracker

type Tracker struct {
	// State tracks the current state of the tracker, Also used for locking distributed access
	Type          ProcessType
	State         TrackerState
	TrackerName   ethereum.TrackerName
	SignedETHTx   []byte
	Validators    []keys.Address
	ProcessOwner  keys.Address
	FinalityVotes []Vote
	To            keys.Address
}

Tracker

func NewTracker

func NewTracker(typ ProcessType, owner keys.Address, signedEthTx []byte, name ethereum.TrackerName, validators []keys.Address) *Tracker

number of validator should be smaller than 64

func (*Tracker) AddVote

func (t *Tracker) AddVote(addr keys.Address, index int64, vote bool) error

func (*Tracker) CheckIfVoted

func (t *Tracker) CheckIfVoted(node keys.Address) (index int64, voted bool)

func (*Tracker) Finalized

func (t *Tracker) Finalized() bool

func (*Tracker) GetJobID

func (t *Tracker) GetJobID(state TrackerState) string

func (*Tracker) GetVotes

func (t *Tracker) GetVotes() (yes, no int)

func (Tracker) NextStep

func (t Tracker) NextStep() string

type TrackerCtx

type TrackerCtx struct {
	Tracker      *Tracker
	TrackerStore *TrackerStore
	JobStore     *jobs.JobStore
	CurrNodeAddr keys.Address
	Validators   *identity.ValidatorStore
}

func NewTrackerCtx

func NewTrackerCtx(t *Tracker, addr keys.Address, js *jobs.JobStore, ts *TrackerStore, vs *identity.ValidatorStore) *TrackerCtx

type TrackerState

type TrackerState int

type TrackerStore

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

func NewTrackerStore

func NewTrackerStore(prefix string, state *storage.State) *TrackerStore

func (*TrackerStore) Delete

func (ts *TrackerStore) Delete(key ethereum.TrackerName) (bool, error)

func (*TrackerStore) Exists

func (ts *TrackerStore) Exists(key ethereum.TrackerName) bool

func (*TrackerStore) Get

func (ts *TrackerStore) Get(key ethereum.TrackerName) (*Tracker, error)

func (*TrackerStore) GetIterator

func (ts *TrackerStore) GetIterator() storage.Iteratable

func (*TrackerStore) GetOption

func (ts *TrackerStore) GetOption() *ethereum.ChainDriverOption

func (*TrackerStore) Iterate

func (ts *TrackerStore) Iterate(fn func(name *ethereum.TrackerName, tracker *Tracker) bool) (stopped bool)

func (*TrackerStore) Set

func (ts *TrackerStore) Set(tracker *Tracker) error

func (*TrackerStore) SetupOption

func (ts *TrackerStore) SetupOption(opt *ethereum.ChainDriverOption)

func (*TrackerStore) WithState

func (ts *TrackerStore) WithState(state *storage.State) *TrackerStore

WithState updates the storage state of the tracker and returns the tracker address back

type Vote

type Vote uint8

Jump to

Keyboard shortcuts

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