db

package
v0.0.0-...-2fe5e27 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDb

func InitDb(options Options) *gorp.DbMap

Types

type BlockNumberofTx

type BlockNumberofTx struct {
	InsertedTS  int64  `db:"inserted_ts"`
	BlockID     string `db:"block_id"`
	NumberOfTxs int64  `db:"number_of_txs"`
}

BlockNumberofTx give us how many transactions a block has

type BlockTX

type BlockTX struct {
	InsertedTS int64  `db:"inserted_ts"`
	BlockID    string `db:"block_id"`
	TxId       string `db:"tx_id"`
}

BlockTx is useful to find out whether we have all the transactions of a block, so we can prepare their representation as trie elements

type EthData

type EthData struct {
	InsertedTS    int64  `db:"inserted_ts"`
	Kind          string `db:"kind"`             // block body, tx receipt, etc
	Hash          string `db:"hash"`             // ethereum hash id
	CID           string `db:"cid"`              // ipld cid, useful, so we compute it once
	Value         string `db:"value"`            // stored in stringed hex
	LastIPFSAddTS int64  `db:"last_ipfs_add_ts"` // last time a client tried to add it into IPFS
	IPFSSuccessTS int64  `db:"ipfs_success_ts"`  // so we know that we have add it at least once

}

EthData is the data retrieved from the devp2p clients we try to keep for the longest time possible our data in here, to give the chance to agents to add it into several libp2p availabilities, however in the future we may want to prune this table.

type LastBlock

type LastBlock struct {
	InsertedTS int64 `db:"inserted_ts"` // doubles as PK
	NumberId   int64 `db:"number_id"`
}

LastBlock tracks the canonical chain. We index using the last inserted value, as there are always chances to rewrites.

type Options

type Options struct {
	User     string
	Password string
	DBName   string
}

Options keep db conn parameters

type TxReceipts

type TxReceipts struct {
	InsertedTS   int64  `db:"inserted_ts"`
	TxId         string `db:"tx_id"`
	TxReceiptsId string `db:"tx_receipts_id"`
}

TxReceipt maps transactions against their receipts

type WantFromDevp2p

type WantFromDevp2p struct {
	InsertedTS    int64  `db:"inserted_ts"`     // doubles as PK
	Kind          string `db:"kind"`            // block body, tx receipt, etc
	Key           string `db:"key"`             // id or hash required
	LastRequestTS int64  `db:"last_request_ts"` // last time we sent a req for this key
	SuccessTS     int64  `db:"success_ts"`      // so we know to not ask again for it
}

WantFromDevp2p is the least of wanted data for our agents to retrieve from different devp2p clients

Jump to

Keyboard shortcuts

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