simple

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProcessForwardsTaskType is the task type for forwards processing.
	ProcessForwardsTaskType = "transaction_simple_process_forwards"
	// ProcessBackwardsTaskType is the task type for backwards processing.
	ProcessBackwardsTaskType = "transaction_simple_process_backwards"
	// VerifyForwardsTaskType is the task type for forwards verification.
	VerifyForwardsTaskType = "transaction_simple_verify_forwards"
	// VerifyBackwardsTaskType is the task type for backwards verification.
	VerifyBackwardsTaskType = "transaction_simple_verify_backwards"
)
View Source
const ProcessorName = "transaction_simple"

ProcessorName is the name of the simple transaction processor.

Variables

This section is empty.

Functions

func NewProcessBackwardsTask

func NewProcessBackwardsTask(payload *ProcessPayload) (*asynq.Task, error)

NewProcessBackwardsTask creates a new backwards process task.

func NewProcessForwardsTask

func NewProcessForwardsTask(payload *ProcessPayload) (*asynq.Task, error)

NewProcessForwardsTask creates a new forwards process task.

func NewVerifyBackwardsTask

func NewVerifyBackwardsTask(payload *VerifyPayload) (*asynq.Task, error)

NewVerifyBackwardsTask creates a new backwards verify task.

func NewVerifyForwardsTask

func NewVerifyForwardsTask(payload *VerifyPayload) (*asynq.Task, error)

NewVerifyForwardsTask creates a new forwards verify task.

Types

type Config

type Config struct {
	clickhouse.Config `yaml:",inline"`
	Enabled           bool   `yaml:"enabled"`
	Table             string `yaml:"table"`
}

Config holds configuration for the simple transaction processor.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

type CountMismatchError

type CountMismatchError struct {
	Expected int
	Actual   int
}

CountMismatchError represents a transaction count mismatch.

func (*CountMismatchError) Error

func (e *CountMismatchError) Error() string

Error implements the error interface.

type Dependencies

type Dependencies struct {
	Log         logrus.FieldLogger
	Pool        *ethereum.Pool
	Network     *ethereum.Network
	State       *state.Manager
	AsynqClient *asynq.Client
	RedisPrefix string
}

Dependencies contains the dependencies needed for the processor.

type ProcessPayload

type ProcessPayload struct {
	BlockNumber    big.Int `json:"block_number"`
	NetworkID      int32   `json:"network_id"`
	NetworkName    string  `json:"network_name"`
	ProcessingMode string  `json:"processing_mode"`
}

ProcessPayload represents the payload for processing a block.

func (*ProcessPayload) MarshalBinary

func (p *ProcessPayload) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*ProcessPayload) UnmarshalBinary

func (p *ProcessPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type Processor

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

Processor handles simple transaction processing.

func New

func New(ctx context.Context, deps *Dependencies, config *Config) (*Processor, error)

New creates a new simple transaction processor.

func (*Processor) EnqueueTask

func (p *Processor) EnqueueTask(ctx context.Context, task *asynq.Task, opts ...asynq.Option) error

EnqueueTask enqueues a task to the specified queue.

func (*Processor) GetHandlers

func (p *Processor) GetHandlers() map[string]asynq.HandlerFunc

GetHandlers returns the task handlers for this processor.

func (*Processor) GetQueues

func (p *Processor) GetQueues() []c.QueueInfo

GetQueues returns the queues used by this processor.

func (*Processor) Name

func (p *Processor) Name() string

Name returns the processor name.

func (*Processor) ProcessNextBlock

func (p *Processor) ProcessNextBlock(ctx context.Context) error

ProcessNextBlock processes the next available block.

func (*Processor) SetProcessingMode

func (p *Processor) SetProcessingMode(mode string)

SetProcessingMode sets the processing mode for the processor.

func (*Processor) Start

func (p *Processor) Start(ctx context.Context) error

Start starts the processor.

func (*Processor) Stop

func (p *Processor) Stop(ctx context.Context) error

Stop stops the processor.

type Transaction

type Transaction struct {
	UpdatedDateTime      time.Time
	BlockNumber          uint64
	BlockHash            string
	ParentHash           string
	TransactionIndex     uint64
	TransactionHash      string
	Nonce                uint64
	FromAddress          string
	ToAddress            *string
	Value                *big.Int // Wei as UInt256
	Input                *string  // Hex-encoded input data
	GasLimit             uint64
	GasUsed              uint64
	GasPrice             uint64
	TransactionType      uint32
	MaxPriorityFeePerGas uint64
	MaxFeePerGas         uint64
	Success              bool
	NInputBytes          uint32
	NInputZeroBytes      uint32
	NInputNonzeroBytes   uint32
	MetaNetworkID        int32
	MetaNetworkName      string
}

Transaction represents a row in the transaction table.

type VerifyPayload

type VerifyPayload struct {
	BlockNumber   big.Int `json:"block_number"`
	NetworkID     int32   `json:"network_id"`
	NetworkName   string  `json:"network_name"`
	InsertedCount int     `json:"inserted_count"`
}

VerifyPayload represents the payload for verifying a block.

func (*VerifyPayload) MarshalBinary

func (v *VerifyPayload) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*VerifyPayload) UnmarshalBinary

func (v *VerifyPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

Jump to

Keyboard shortcuts

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