Documentation ¶
Overview ¶
Implements generic layers for building ABCI-applications.
Index ¶
- type AppMetadata
- type DedupLayer
- type HashCounter
- func (t *HashCounter) Commit() types.ResponseCommit
- func (t *HashCounter) DeliverTx(tx []byte) (a types.ResponseDeliverTx)
- func (t *HashCounter) EndBlock(q types.RequestEndBlock) types.ResponseEndBlock
- func (t *HashCounter) Info(q types.RequestInfo) (a types.ResponseInfo)
- func (t *HashCounter) InitChain(q types.RequestInitChain) (a types.ResponseInitChain)
- func (t *HashCounter) OnStart() error
- type HashMemory
- type Tx2Key
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppMetadata ¶
type AppMetadata struct { types.Application // The fields to set in Info-Responses Version string AppVersion uint64 }
An ABCI-application layer, that sets the .Version and .AppVersion fields in Info-responses to specified values.
func (*AppMetadata) Info ¶
func (t *AppMetadata) Info(q types.RequestInfo) (a types.ResponseInfo)
type DedupLayer ¶
type DedupLayer struct { types.Application DB dbm.DB KeyExtractor Tx2Key // contains filtered or unexported fields }
An ABCI-application layer, that de-duplicates transactions. From the transaction, a key is extracted. If there is no such key extraction function, the transaction itself is the key.
The key is hashed with a 32-bit function (FNV1a) and truncated to 24-bit, so that maximum number of hash buckets is 2²⁴ (~ 16 millions).
In the case of a hash collision in the truncated 24-bit hash space, the algorithm can fail to detect some duplicate TX-keys, but the algorithm guarantees, that no TX-keys are falsely detected as duplicates.
The bucket numbers are formatted as hex with the "dedup" prefix, so that a key looks like "dedupF2A450".
func (*DedupLayer) CheckTx ¶
func (d *DedupLayer) CheckTx(tx []byte) (q types.ResponseCheckTx)
func (*DedupLayer) Commit ¶
func (d *DedupLayer) Commit() (a types.ResponseCommit)
func (*DedupLayer) DeliverTx ¶
func (d *DedupLayer) DeliverTx(tx []byte) (q types.ResponseDeliverTx)
type HashCounter ¶
type HashCounter struct { types.Application DB dbm.DB // contains filtered or unexported fields }
An ABCI-application layer, that calculates a block-hash upon commit and implements the Info-method correctly (returning the latest Commit block height and app hash). It also hashes all transactions, that are successfully submitted through DeliverTx.
The user MAY optionallysupply a value in the database with the key "bcseed". This is like a shared secret, that must be the same on each Blockchain-member.
The layer manages a record with the key "info", which contains a JSON object holding the last Block-Height and the last App-Hash.
func (*HashCounter) Commit ¶
func (t *HashCounter) Commit() types.ResponseCommit
func (*HashCounter) DeliverTx ¶
func (t *HashCounter) DeliverTx(tx []byte) (a types.ResponseDeliverTx)
func (*HashCounter) EndBlock ¶
func (t *HashCounter) EndBlock(q types.RequestEndBlock) types.ResponseEndBlock
func (*HashCounter) Info ¶
func (t *HashCounter) Info(q types.RequestInfo) (a types.ResponseInfo)
func (*HashCounter) InitChain ¶
func (t *HashCounter) InitChain(q types.RequestInitChain) (a types.ResponseInitChain)
func (*HashCounter) OnStart ¶
func (t *HashCounter) OnStart() error
type HashMemory ¶
type HashMemory struct { types.Application // contains filtered or unexported fields }
An ABCI-application layer, wraps EndBlock and Commit and conveys both .LastBlockHeight end .LastBlockAppHash out to the Info-method.
This Method is only suited for transient, in-memory Applications.
func (*HashMemory) Commit ¶
func (t *HashMemory) Commit() types.ResponseCommit
func (*HashMemory) EndBlock ¶
func (t *HashMemory) EndBlock(q types.RequestEndBlock) types.ResponseEndBlock
func (*HashMemory) Info ¶
func (t *HashMemory) Info(q types.RequestInfo) (a types.ResponseInfo)