machine

package
v0.0.0-...-6d87009 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProcessPlatformQuorum   = "quorum"
	ProcessCreditMulplifier = 10
)

Variables

View Source
var (
	// because the sdk bug, this output is skipped, and should always be in the future
	InvalidCollectibleOutputHackMap = map[string]bool{
		"271d7ef5-6bf3-3b96-9c0c-701f7a989435": true,
		"8f96c027-fbf0-39dc-99b7-6ba6cdf9c66c": true,
		"5bb0997f-669a-3e65-8c2f-5cc15de4c9ca": true,
		"175620b8-f4b8-3e66-84bb-669c62d5140d": true,
	}
)

Functions

func OutputGrouper

func OutputGrouper(out *mtg.Output) string

Types

type AccountSnapshot

type AccountSnapshot struct {
	Process string
	Nonce   uint64
	Asset   string
	Amount  common.Integer
	Credit  bool
}

type Asset

type Asset struct {
	Id     string
	Symbol string
	Name   string
}

type CollectibleToken

type CollectibleToken struct {
	Id               string
	CollectionId     string
	TokenNumber      string
	CollectionName   string
	CollectionSymbol string
}

type Configuration

type Configuration struct {
	Poly             string `toml:"poly"`
	Share            string `toml:"share"`
	ProcessFeeAsset  string `toml:"process-fee-asset"`
	ProcessFeeAmount string `toml:"process-fee-amount"`
}

type Engine

type Engine interface {
	VerifyAddress(addr string, extra []byte) error
	SetupNotifier(addr string) error
	VerifyEvent(address string, event *encoding.Event) bool
	EstimateCost(events []*encoding.Event) (common.Integer, error)
	EnsureSendGroupEvents(address string, events []*encoding.Event) error
	ReceiveGroupEvents(address string, offset uint64, limit int) ([]*encoding.Event, error)
}

type Machine

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

func Boot

func Boot(conf *Configuration, group *mtg.Group, store Store, m messenger.Messenger, mixin *mixin.Client) (*Machine, error)

func (*Machine) AddEngine

func (m *Machine) AddEngine(platform string, engine Engine)

func (*Machine) AddProcess

func (m *Machine) AddProcess(ctx context.Context, pid string, platform, address string, out *mtg.Output, extra []byte) bool

func (*Machine) Loop

func (m *Machine) Loop(ctx context.Context)

func (*Machine) ProcessCollectibleOutput

func (m *Machine) ProcessCollectibleOutput(ctx context.Context, out *mtg.CollectibleOutput)

func (*Machine) ProcessOutput

func (m *Machine) ProcessOutput(ctx context.Context, out *mtg.Output)

func (*Machine) Spawn

func (m *Machine) Spawn(ctx context.Context, p *Process)

func (*Machine) WriteGroupEvent

func (m *Machine) WriteGroupEvent(ctx context.Context, pid string, out *mtg.Output, extra []byte)

func (*Machine) WriteNFOGroupEvent

func (m *Machine) WriteNFOGroupEvent(ctx context.Context, pid string, out *mtg.CollectibleOutput, extra []byte)

type Process

type Process struct {
	Identifier string
	Platform   string
	Address    string
	Credit     common.Integer
	Nonce      uint64

	Asset bool
}

type Store

type Store interface {
	CheckPendingGroupEventIdentifier(id string) (bool, error)
	WritePendingGroupEventAndNonce(event *encoding.Event, id string) error
	ListPendingGroupEvents(limit int) ([]*encoding.Event, error)
	ReadGroupEventSignatures(pid string, nonce uint64) ([][]byte, bool, error)
	WritePendingGroupEventSignatures(pid string, nonce uint64, partials [][]byte) error
	WriteSignedGroupEventAndExpirePending(event *encoding.Event) error
	ListSignedGroupEvents(pid string, limit int) ([]*encoding.Event, error)
	ExpireGroupEventsWithCost(events []*encoding.Event, cost common.Integer) error

	CheckAccountSnapshot(as *AccountSnapshot) (bool, error)
	WriteAccountSnapshot(as *AccountSnapshot) error

	ReadEngineGroupEventsOffset(pid string) (uint64, error)
	WriteEngineGroupEventsOffset(pid string, offset uint64) error

	ListProcesses() ([]*Process, error)
	WriteProcess(p *Process) error

	WriteAssetOrCollectible(id, category string) error
	ReadAssetOrCollectible(id string) (string, error)

	WriteAsset(a *Asset) error
	ReadAsset(id string) (*Asset, error)

	WriteCollectibleToken(t *CollectibleToken) error
	ReadCollectibleToken(id string) (*CollectibleToken, error)
}

Jump to

Keyboard shortcuts

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