model

package
v0.0.0-...-54b74c5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

The nonodo model uses a shared-memory paradigm to synchronize between threads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	HandleOutput(
		ctx context.Context,
		destination common.Address,
		payload string,
		inputIndex uint64,
		outputIndex uint64,
	) error
}

Convenience OutputDecoder

type InputFilter

type InputFilter struct {
	IndexGreaterThan *int
	IndexLowerThan   *int
}

Filter inputs.

func (InputFilter) Filter

func (f InputFilter) Filter(i *cModel.AdvanceInput) bool

Return true when the given input should be filtered.

type InspectInput

type InspectInput struct {
	Index               int
	Status              cModel.CompletionStatus
	Payload             []byte
	ProcessedInputCount int
	Reports             []Report
	Exception           []byte
}

Rollups inspect input type.

type MetadataFilter

type MetadataFilter struct {
	Field string

	// Basic comparison operators
	Eq  *string
	Ne  *string
	Gt  *string
	Gte *string
	Lt  *string
	Lte *string

	// Inclusion/exclusion operators
	In  []*string
	Nin []*string

	// Logical operators
	And []*MetadataFilter
	Or  []*MetadataFilter
}

type NonodoModel

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

Nonodo model shared among the internal workers. The model store inputs as pointers because these pointers are shared with the rollup state.

func NewNonodoModel

func NewNonodoModel(
	decoder Decoder,
	reportRepository *cRepos.ReportRepository,
	inputRepository *cRepos.InputRepository,
	voucherRepository *cRepos.VoucherRepository,
	noticeRepository *cRepos.NoticeRepository,
) *NonodoModel

Create a new model.

func (*NonodoModel) AddAdvanceInput

func (m *NonodoModel) AddAdvanceInput(
	sender common.Address,
	payload string,
	blockNumber uint64,
	timestamp time.Time,
	inputBoxIndex int,
	prevRandao string,
	appContract common.Address,
	chainId string,
) error

Add an advance input to the model.

func (*NonodoModel) AddInspectInput

func (m *NonodoModel) AddInspectInput(payload []byte) int

Add an inspect input to the model. Return the inspect input index that should be used for polling.

func (*NonodoModel) AddNotice

func (m *NonodoModel) AddNotice(payload []byte, appAddress common.Address) (int, error)

Add a notice to the model. Return the notice index within the input. Return an error if the state isn't advance.

func (*NonodoModel) AddNoticeWithInput

func (m *NonodoModel) AddNoticeWithInput(payload []byte, inputIndex int) (int, error)

Add a notice with input index to the model. Return the notice index within the input. Return an error if the state isn't advance.

func (*NonodoModel) AddReport

func (m *NonodoModel) AddReport(appAddress common.Address, payload []byte) error

Add a report to the model. Return an error if the state isn't advance or inspect.

func (*NonodoModel) AddVoucher

func (m *NonodoModel) AddVoucher(appAddress common.Address, destination common.Address, value string, payload []byte) (int, error)

Add a voucher to the model. Return the voucher index within the input. Return an error if the state isn't advance.

func (*NonodoModel) AddVoucherWithInput

func (m *NonodoModel) AddVoucherWithInput(destination common.Address, payload []byte, inputIndex int) (int, error)

func (*NonodoModel) GetInputRepository

func (m *NonodoModel) GetInputRepository() *cRepos.InputRepository

func (*NonodoModel) GetInspectInput

func (m *NonodoModel) GetInspectInput(index int) (InspectInput, error)

Get the inspect input from the model.

func (*NonodoModel) RegisterException

func (m *NonodoModel) RegisterException(payload []byte) error

Finish the current input with an exception. Return an error if the state isn't advance or inspect.

type Notice

type Notice struct {
	Index      int
	InputIndex int
	Payload    []byte
}

Rollups notice type.

func (Notice) GetInputIndex

func (n Notice) GetInputIndex() int

type Output

type Output interface {
	GetInputIndex() int
}

Interface implemented by vouchers, notices, and reports.

type OutputFilter

type OutputFilter struct {
	InputIndex *int
}

Filter outputs (vouchers, notices, and reports).

func (OutputFilter) Filter

func (f OutputFilter) Filter(o Output) bool

Return true when the given output should be filtered.

type Report

type Report struct {
	Index      int
	InputIndex int
	Payload    []byte
}

Rollups report type.

func (Report) GetInputIndex

func (r Report) GetInputIndex() int

type Voucher

type Voucher struct {
	Index       int
	InputIndex  int
	Destination common.Address
	Payload     []byte
}

Rollups voucher type.

func (Voucher) GetInputIndex

func (v Voucher) GetInputIndex() int

Jump to

Keyboard shortcuts

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