ethereum

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

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

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

	ProcessTypeNone      ProcessType = 0x00
	ProcessTypeLock      ProcessType = 0x01
	ProcessTypeRedeem    ProcessType = 0x02
	ProcessTypeLockERC   ProcessType = 0x03
	ProcessTypeRedeemERC ProcessType = 0x04
)

Variables

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

Functions

This section is empty.

Types

type PrefixType added in v0.14.0

type PrefixType int8
const (
	PrefixFailed  PrefixType = 0x00
	PrefixPassed  PrefixType = 0x01
	PrefixOngoing PrefixType = 0x02
)

type ProcessType

type ProcessType int8

func (ProcessType) String added in v0.14.0

func (t ProcessType) String() string

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
	Witnesses     []keys.Address
	ProcessOwner  keys.Address
	FinalityVotes []Vote
	To            []byte
}

Tracker

func NewTracker

func NewTracker(typ ProcessType, owner keys.Address, signedEthTx []byte, name ethereum.TrackerName, witnesses []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) Clean added in v0.14.0

func (t *Tracker) Clean() *Tracker

func (*Tracker) Failed added in v0.14.0

func (t *Tracker) Failed() 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
	Witnesses    *identity.WitnessStore
	Logger       *log.Logger
}

func NewTrackerCtx

func NewTrackerCtx(t *Tracker, addr keys.Address, js *jobs.JobStore, ts *TrackerStore, ws *identity.WitnessStore, log *log.Logger) *TrackerCtx

type TrackerState

type TrackerState int

func (TrackerState) String added in v0.14.0

func (t TrackerState) String() string

type TrackerStore

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

func NewTrackerStore

func NewTrackerStore(prefixon string, prefixfail string, prefixsuccess 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) GetIterable added in v0.14.0

func (ts *TrackerStore) GetIterable() storage.Iterable

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) QueryAllStores added in v0.14.0

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

func (*TrackerStore) Set

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

func (*TrackerStore) SetupOption

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

func (*TrackerStore) WithPrefix added in v0.14.0

func (ts *TrackerStore) WithPrefix(prefix []byte) *TrackerStore

func (*TrackerStore) WithPrefixType added in v0.14.0

func (ts *TrackerStore) WithPrefixType(prefix PrefixType) *TrackerStore

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