Documentation ¶
Index ¶
- type OffChainDataHandler
- func (d *OffChainDataHandler) Commit(_ uint32) error
- func (*OffChainDataHandler) OnBeginBlock(state.BeginBlock)
- func (*OffChainDataHandler) OnCancel(_ []byte, _ int32)
- func (d *OffChainDataHandler) OnCensusUpdate(pid, censusRoot []byte, censusURI string)
- func (*OffChainDataHandler) OnNewTx(_ *vochaintx.Tx, _ uint32, _ int32)
- func (d *OffChainDataHandler) OnProcess(pid, _ []byte, censusRoot, censusURI string, _ int32)
- func (*OffChainDataHandler) OnProcessKeys(_ []byte, _ string, _ int32)
- func (*OffChainDataHandler) OnProcessResults(_ []byte, _ *models.ProcessResult, _ int32)
- func (*OffChainDataHandler) OnProcessStatusChange(_ []byte, _ models.ProcessStatus, _ int32)
- func (*OffChainDataHandler) OnProcessesStart(_ [][]byte)
- func (*OffChainDataHandler) OnRevealKeys(_ []byte, _ string, _ int32)
- func (d *OffChainDataHandler) OnSetAccount(_ []byte, account *state.Account)
- func (*OffChainDataHandler) OnSpendTokens(_ []byte, _ models.TxType, _ uint64, _ string)
- func (*OffChainDataHandler) OnTransferTokens(_ *vochaintx.TokenTransfer)
- func (*OffChainDataHandler) OnVote(_ *state.Vote, _ int32)
- func (d *OffChainDataHandler) Rollback()
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) OnTransferTokens ¶
func (*OffChainDataHandler) OnTransferTokens(_ *vochaintx.TokenTransfer)
func (*OffChainDataHandler) Rollback ¶
func (d *OffChainDataHandler) Rollback()
Rollback is called when a new block is reverted, so we revert the import actions.