Documentation
¶
Index ¶
- Constants
- Variables
- type Block
- func (blk Block) Clone() (res Block)
- func (z *Block) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Block) EncodeMsg(en *msgp.Writer) (err error)
- func (z *Block) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Block) Msgsize() (s int)
- func (z *Block) UnmarshalMsg(bts []byte) (o []byte, err error)
- type BlockIndex
- type ConvertedOp
- type DB
- type DeletedOp
- type ExtendedBlock
- func (z *ExtendedBlock) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *ExtendedBlock) EncodeMsg(en *msgp.Writer) (err error)
- func (z *ExtendedBlock) MarshalMsg(b []byte) (o []byte, err error)
- func (z *ExtendedBlock) Msgsize() (s int)
- func (z *ExtendedBlock) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ExtractNotificationFromTxFn
- type IndexEntry
- type Log
- type NewLostAndFoundOp
- type NewRedeemableOp
- type OpListsForCcUtxo
- type RedeemOp
- type Tx
Constants ¶
const ( FROM_ADDR_KEY byte = 9 TO_ADDR_KEY byte = 10 TRANS_FROM_ADDR_KEY byte = 11 TRANS_TO_ADDR_KEY byte = 12 )
Variables ¶
var TransferEvent = [32]byte{
0xdd, 0xf2, 0x52, 0xad, 0x1b, 0xe2, 0xc8, 0x9b,
0x69, 0xc2, 0xb0, 0x68, 0xfc, 0x37, 0x8d, 0xaa,
0x95, 0x2b, 0xa7, 0xf1, 0x63, 0xc4, 0xa1, 0x16,
0x28, 0xf5, 0x5a, 0x4d, 0xf5, 0x23, 0xb3, 0xef,
}
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Height int64 `msg:"ht"` BlockHash [32]byte `msg:"bh"` BlockInfo []byte `msg:"bi"` // the pre-serialized payload TxList []Tx `msg:"tx"` }
To index a block, we need its height and hash
func (*Block) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type BlockIndex ¶
type BlockIndex struct { Height uint32 `msg:"ht"` BlockHash [32]byte `msg:"bH"` BlockHash48 uint64 `msg:"bh"` TxHash48List []uint64 `msg:"thl"` BeginOffset int64 `msg:"bo"` TxPosList []int64 `msg:"tpl"` SrcHashes []uint64 `msg:"sh"` SrcPosLists [][]uint32 `msg:"sp"` DstHashes []uint64 `msg:"dh"` DstPosLists [][]uint32 `msg:"dp"` AddrHashes []uint64 `msg:"ah"` AddrPosLists [][]uint32 `msg:"ap"` TopicHashes []uint64 `msg:"th"` TopicPosLists [][]uint32 `msg:"tp"` }
the index information for a block. we use it to build in-memory index for a block, and erase the index when this block is considered too old.
func (*BlockIndex) DecodeMsg ¶
func (z *BlockIndex) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*BlockIndex) EncodeMsg ¶
func (z *BlockIndex) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*BlockIndex) MarshalMsg ¶
func (z *BlockIndex) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*BlockIndex) Msgsize ¶
func (z *BlockIndex) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*BlockIndex) UnmarshalMsg ¶
func (z *BlockIndex) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type ConvertedOp ¶
type DB ¶
type DB interface { Close() SetExtractNotificationFn(fn ExtractNotificationFromTxFn) SetDisableComplexIndex(b bool) GetLatestHeight() int64 AddBlock(blk *Block, pruneTillHeight int64, txid2sigMap map[[32]byte][65]byte) GetBlockHashByHeight(height int64) [32]byte GetBlockByHeight(height int64) []byte GetTxByHeightAndIndex(height int64, index int) []byte GetTxListByHeight(height int64) [][]byte GetTxListByHeightWithRange(height int64, start, end int) [][]byte GetBlockByHash(hash [32]byte, collectResult func([]byte) bool) GetTxByHash(hash [32]byte, collectResult func([]byte) bool) BasicQueryLogs(addr *[20]byte, topics [][32]byte, startHeight, endHeight uint32, fn func([]byte) bool) error QueryLogs(addrOrList [][20]byte, topicsOrList [][][32]byte, startHeight, endHeight uint32, fn func([]byte) bool) error QueryTxBySrc(addr [20]byte, startHeight, endHeight uint32, fn func([]byte) bool) error QueryTxByDst(addr [20]byte, startHeight, endHeight uint32, fn func([]byte) bool) error QueryTxBySrcOrDst(addr [20]byte, startHeight, endHeight uint32, fn func([]byte) bool) error QueryNotificationCounter(key []byte) int64 SetOpListsForCcUtxo(opListsForCcUtxo OpListsForCcUtxo) GetUtxoInfos() (infos [][36 + 1 + 20]byte) GetAllUtxoIds() [][36]byte GetRedeemableUtxoIds() [][36]byte GetLostAndFoundUtxoIds() [][36]byte GetRedeemingUtxoIds() [][36]byte GetUtxoIdsByCovenantAddr(covenantAddr [20]byte) [][36]byte GetRedeemableUtxoIdsByCovenantAddr(covenantAddr [20]byte) [][36]byte // This function's parameter limits these functions' returned entry count: BasicQueryLogs, QueryLogs, QueryTxBySrc, QueryTxByDst, QueryTxBySrcOrDst SetMaxEntryCount(c int) }
the interface provided by DB
type ExtendedBlock ¶
type ExtendedBlock struct { Block Txid2sigMap map[string][65]byte `msg:"t2s"` UpdateOfADS map[string]string `msg:"ua"` }
Extend the 'Block' type to include txid2sigMap and ads's update data
func (*ExtendedBlock) DecodeMsg ¶
func (z *ExtendedBlock) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*ExtendedBlock) EncodeMsg ¶
func (z *ExtendedBlock) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*ExtendedBlock) MarshalMsg ¶
func (z *ExtendedBlock) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*ExtendedBlock) Msgsize ¶
func (z *ExtendedBlock) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*ExtendedBlock) UnmarshalMsg ¶
func (z *ExtendedBlock) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type IndexEntry ¶
an entry for address index or topic index
func (*IndexEntry) DecodeMsg ¶
func (z *IndexEntry) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*IndexEntry) EncodeMsg ¶
func (z *IndexEntry) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*IndexEntry) MarshalMsg ¶
func (z *IndexEntry) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*IndexEntry) Msgsize ¶
func (z *IndexEntry) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*IndexEntry) UnmarshalMsg ¶
func (z *IndexEntry) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Log ¶
To index an EVM Log, we need its smartcontract's Address, and hashes of the Topics
func (*Log) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type NewLostAndFoundOp ¶
type NewRedeemableOp ¶
type OpListsForCcUtxo ¶
type OpListsForCcUtxo struct { NewRedeemableOps []NewRedeemableOp NewLostAndFoundOps []NewLostAndFoundOp RedeemOps []RedeemOp ConvertedOps []ConvertedOp DeletedOps []DeletedOp }
type Tx ¶
type Tx struct { HashId [32]byte `msg:"h"` SrcAddr [20]byte `msg:"s"` DstAddr [20]byte `msg:"d"` Content []byte `msg:"c"` // the pre-serialized payload LogList []Log `msg:"l"` }
To index a transaction, we need its SrcAddr, DstAddr, HashId and the Logs in it
func (*Tx) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler