offchaindatahandler

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OffChainDataHandler

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

OffChainDataHandler is a Vochain event handler aimed to fetch offchain data (usually on IPFS).

func NewOffChainDataHandler

func NewOffChainDataHandler(v *vochain.BaseApplication, d *downloader.Downloader,
	c *censusdb.CensusDB, importOnlyNew bool) *OffChainDataHandler

NewOffChainDataHandler creates a new instance of the off chain data downloader daemon. It will subscribe to Vochain events and perform data import.

func (*OffChainDataHandler) Commit

func (d *OffChainDataHandler) Commit(_ uint32) error

Commit is called when a new block is committed, so we execute the import actions enqueued by the event handlers (else the queues are reverted by calling Rollback).

func (*OffChainDataHandler) OnBeginBlock added in v1.9.0

func (*OffChainDataHandler) OnBeginBlock(state.BeginBlock)

func (*OffChainDataHandler) OnCancel

func (*OffChainDataHandler) OnCancel(_ []byte, _ int32)

NOT USED but required for implementing the vochain.EventListener interface

func (*OffChainDataHandler) OnCensusUpdate added in v1.9.0

func (d *OffChainDataHandler) OnCensusUpdate(pid, censusRoot []byte, censusURI string)

OnCensusUpdate is triggered when the census is updated during an election.

func (*OffChainDataHandler) OnNewTx

func (*OffChainDataHandler) OnNewTx(_ *vochaintx.Tx, _ uint32, _ int32)

func (*OffChainDataHandler) OnProcess

func (d *OffChainDataHandler) OnProcess(pid, _ []byte, censusRoot, censusURI string, _ int32)

OnProcess is triggered when a new election is created. It checks if the election contains offchain data that needs to be imported and enqueues it for being handled by Commit.

func (*OffChainDataHandler) OnProcessKeys

func (*OffChainDataHandler) OnProcessKeys(_ []byte, _ string, _ int32)

func (*OffChainDataHandler) OnProcessResults

func (*OffChainDataHandler) OnProcessResults(_ []byte, _ *models.ProcessResult, _ int32)

func (*OffChainDataHandler) OnProcessStatusChange

func (*OffChainDataHandler) OnProcessStatusChange(_ []byte, _ models.ProcessStatus, _ int32)

func (*OffChainDataHandler) OnProcessesStart

func (*OffChainDataHandler) OnProcessesStart(_ [][]byte)

OnProcessesStart is triggered when a process starts. Does nothing.

func (*OffChainDataHandler) OnRevealKeys

func (*OffChainDataHandler) OnRevealKeys(_ []byte, _ string, _ int32)

func (*OffChainDataHandler) OnSetAccount

func (d *OffChainDataHandler) OnSetAccount(_ []byte, account *state.Account)

OnSetAccount is triggered when a new account is created or modified. If metadata info is present, it is enqueued.

func (*OffChainDataHandler) OnSpendTokens added in v1.9.0

func (*OffChainDataHandler) OnSpendTokens(_ []byte, _ models.TxType, _ uint64, _ string)

func (*OffChainDataHandler) OnTransferTokens

func (*OffChainDataHandler) OnTransferTokens(_ *vochaintx.TokenTransfer)

func (*OffChainDataHandler) OnVote

func (*OffChainDataHandler) OnVote(_ *state.Vote, _ int32)

func (*OffChainDataHandler) Rollback

func (d *OffChainDataHandler) Rollback()

Rollback is called when a new block is reverted, so we revert the import actions.

Jump to

Keyboard shortcuts

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