Documentation ¶
Overview ¶
The nonodo model uses a shared-memory paradigm to synchronize between threads.
Index ¶
- Constants
- type AdvanceInput
- type CompletionStatus
- type Decoder
- type Input
- type InputFilter
- type InputRepository
- func (c *InputRepository) Count(filter []*model.ConvenienceFilter) (uint64, error)
- func (r *InputRepository) Create(input AdvanceInput) (*AdvanceInput, error)
- func (r *InputRepository) CreateTables() error
- func (c *InputRepository) FindAll(first *int, last *int, after *string, before *string, ...) (*commons.PageResult[AdvanceInput], error)
- func (r *InputRepository) FindByIndex(index int) (*AdvanceInput, error)
- func (r *InputRepository) FindByStatus(status CompletionStatus) (*AdvanceInput, error)
- func (r *InputRepository) Update(input AdvanceInput) (*AdvanceInput, error)
- type InspectInput
- type MetadataFilter
- type NonodoModel
- func (m *NonodoModel) AddAdvanceInput(sender common.Address, payload []byte, blockNumber uint64, timestamp time.Time, ...)
- func (m *NonodoModel) AddInspectInput(payload []byte) int
- func (m *NonodoModel) AddNotice(payload []byte) (int, error)
- func (m *NonodoModel) AddReport(payload []byte) error
- func (m *NonodoModel) AddVoucher(destination common.Address, payload []byte) (int, error)
- func (m *NonodoModel) FinishAndGetNext(accepted bool) Input
- func (m *NonodoModel) GetInspectInput(index int) InspectInput
- func (m *NonodoModel) RegisterException(payload []byte) error
- type Notice
- type Output
- type OutputFilter
- type Report
- type ReportRepository
- func (c *ReportRepository) Count(filter []*model.ConvenienceFilter) (uint64, error)
- func (r *ReportRepository) Create(report Report) (Report, error)
- func (r *ReportRepository) CreateTables() error
- func (c *ReportRepository) FindAll(first *int, last *int, after *string, before *string, ...) (*commons.PageResult[Report], error)
- func (c *ReportRepository) FindAllByInputIndex(first *int, last *int, after *string, before *string, inputIndex *int) (*commons.PageResult[Report], error)
- func (r *ReportRepository) FindByInputAndOutputIndex(inputIndex uint64, outputIndex uint64) (*Report, error)
- type Voucher
Constants ¶
const INDEX_FIELD = "Index"
const INPUT_INDEX = "InputIndex"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdvanceInput ¶
type AdvanceInput struct { Index int Status CompletionStatus MsgSender common.Address Payload []byte BlockNumber uint64 Timestamp time.Time Vouchers []Voucher Notices []Notice Reports []Report Exception []byte }
Rollups advance input type.
type CompletionStatus ¶
type CompletionStatus int
Completion status for inputs.
const ( CompletionStatusUnprocessed CompletionStatus = iota CompletionStatusAccepted CompletionStatusRejected CompletionStatusException )
type Decoder ¶
type Decoder interface { HandleOutput( ctx context.Context, destination common.Address, payload string, inputIndex uint64, outputIndex uint64, ) error }
Convenience OutputDecoder
type InputFilter ¶
Filter inputs.
func (InputFilter) Filter ¶
func (f InputFilter) Filter(i *AdvanceInput) bool
Return true when the given input should be filtered.
type InputRepository ¶
func (*InputRepository) Count ¶
func (c *InputRepository) Count( filter []*model.ConvenienceFilter, ) (uint64, error)
func (*InputRepository) Create ¶
func (r *InputRepository) Create(input AdvanceInput) (*AdvanceInput, error)
func (*InputRepository) CreateTables ¶
func (r *InputRepository) CreateTables() error
func (*InputRepository) FindAll ¶
func (c *InputRepository) FindAll( first *int, last *int, after *string, before *string, filter []*model.ConvenienceFilter, ) (*commons.PageResult[AdvanceInput], error)
func (*InputRepository) FindByIndex ¶
func (r *InputRepository) FindByIndex(index int) (*AdvanceInput, error)
func (*InputRepository) FindByStatus ¶
func (r *InputRepository) FindByStatus(status CompletionStatus) (*AdvanceInput, error)
func (*InputRepository) Update ¶
func (r *InputRepository) Update(input AdvanceInput) (*AdvanceInput, error)
type InspectInput ¶
type InspectInput struct { Index int Status 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 }
func CreateFilterList ¶
func CreateFilterList(content string) []*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, db *sqlx.DB) *NonodoModel
Create a new model.
func (*NonodoModel) AddAdvanceInput ¶
func (m *NonodoModel) AddAdvanceInput( sender common.Address, payload []byte, blockNumber uint64, timestamp time.Time, index int, )
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) (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) AddReport ¶
func (m *NonodoModel) AddReport(payload []byte) error
Add a report to the model. Return an error if the state isn't advance or inspect.
func (*NonodoModel) AddVoucher ¶
Add a voucher to the model. Return the voucher index within the input. Return an error if the state isn't advance.
func (*NonodoModel) FinishAndGetNext ¶
func (m *NonodoModel) FinishAndGetNext(accepted bool) Input
Finish the current input and get the next one. If there is no input to be processed return nil.
func (*NonodoModel) GetInspectInput ¶
func (m *NonodoModel) GetInspectInput(index int) InspectInput
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 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 ReportRepository ¶
func (*ReportRepository) Count ¶
func (c *ReportRepository) Count( filter []*model.ConvenienceFilter, ) (uint64, error)
func (*ReportRepository) CreateTables ¶
func (r *ReportRepository) CreateTables() error
func (*ReportRepository) FindAll ¶
func (c *ReportRepository) FindAll( first *int, last *int, after *string, before *string, filter []*model.ConvenienceFilter, ) (*commons.PageResult[Report], error)
func (*ReportRepository) FindAllByInputIndex ¶
func (c *ReportRepository) FindAllByInputIndex( first *int, last *int, after *string, before *string, inputIndex *int, ) (*commons.PageResult[Report], error)
func (*ReportRepository) FindByInputAndOutputIndex ¶
func (r *ReportRepository) FindByInputAndOutputIndex( inputIndex uint64, outputIndex uint64, ) (*Report, error)