Documentation
¶
Index ¶
- type Database
- func (db *Database) BlockCountAtDAAScore(databaseTransaction *pg.Tx, blockDAAScore uint64) (uint32, error)
- func (db *Database) BlockHeight(databaseTransaction *pg.Tx, blockID uint64) (uint64, error)
- func (db *Database) BlockHeightByHash(databaseTransaction *pg.Tx, blockHash *externalapi.DomainHash) (uint64, error)
- func (db *Database) BlockHeightGroupIndex(databaseTransaction *pg.Tx, blockID uint64) (uint32, error)
- func (db *Database) BlockIDByDAAScore(databaseTransaction *pg.Tx, blockDAAScore uint64) (uint64, error)
- func (db *Database) BlockIDByHash(databaseTransaction *pg.Tx, blockHash *externalapi.DomainHash) (uint64, error)
- func (db *Database) BlockIDsAndHeightsByHashes(databaseTransaction *pg.Tx, blockHashes []*externalapi.DomainHash) ([]uint64, []uint64, error)
- func (db *Database) BlockIDsByHashes(databaseTransaction *pg.Tx, blockHashes []*externalapi.DomainHash) ([]uint64, error)
- func (db *Database) Clear(databaseTransaction *pg.Tx) error
- func (db *Database) Close()
- func (db *Database) DoesBlockExist(databaseTransaction *pg.Tx, blockHash *externalapi.DomainHash) (bool, error)
- func (db *Database) FindLatestStoredBlockIndex(databaseTransaction *pg.Tx, blockHashes []*externalapi.DomainHash) (int, error)
- func (db *Database) GetAppConfig(databaseTransaction *pg.Tx) (*model.AppConfig, error)
- func (db *Database) GetBlock(databaseTransaction *pg.Tx, id uint64) (*model.Block, error)
- func (db *Database) HashesToBlockIDs(databaseTransaction *pg.Tx, blockHashes []*externalapi.DomainHash) ([]uint64, []*externalapi.DomainHash)
- func (db *Database) HeightGroupSize(databaseTransaction *pg.Tx, height uint64) (uint32, error)
- func (db *Database) HighestBlockHeight(databaseTransaction *pg.Tx, blockIDs []uint64) (uint64, error)
- func (db *Database) HighestBlockInVirtualSelectedParentChain(databaseTransaction *pg.Tx) (*model.Block, error)
- func (db *Database) InsertBlock(databaseTransaction *pg.Tx, blockHash *externalapi.DomainHash, ...) error
- func (db *Database) InsertEdge(databaseTransaction *pg.Tx, edge *model.Edge) error
- func (db *Database) InsertOrUpdateHeightGroup(databaseTransaction *pg.Tx, heightGroup *model.HeightGroup) error
- func (db *Database) LoadCache(databaseTransaction *pg.Tx, minHeight uint64) error
- func (db *Database) RunInTransaction(transactionFunction func(*pg.Tx) error) error
- func (db *Database) StoreAppConfig(databaseTransaction *pg.Tx, appConfig *model.AppConfig) error
- func (db *Database) UpdateBlockColors(databaseTransaction *pg.Tx, blockIDsToColors map[uint64]string) error
- func (db *Database) UpdateBlockDAAScores(databaseTransaction *pg.Tx, blockIDsToDAAScores map[uint64]uint64) error
- func (db *Database) UpdateBlockIsInVirtualSelectedParentChain(databaseTransaction *pg.Tx, ...) error
- func (db *Database) UpdateBlockMergeSet(databaseTransaction *pg.Tx, blockID uint64, mergeSetRedIDs []uint64, ...) error
- func (db *Database) UpdateBlockSelectedParent(databaseTransaction *pg.Tx, blockID uint64, selectedParentID uint64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
func (*Database) BlockCountAtDAAScore ¶
func (db *Database) BlockCountAtDAAScore(databaseTransaction *pg.Tx, blockDAAScore uint64) (uint32, error)
BlockCountAtDAAScore returns the number of blocks having a DAA Score of `blockDAAScore`
func (*Database) BlockHeight ¶
func (*Database) BlockHeightByHash ¶
func (db *Database) BlockHeightByHash(databaseTransaction *pg.Tx, blockHash *externalapi.DomainHash) (uint64, error)
blockBaseByHash returns the height of a block idendified by `blockHash`. Returns an error if `blockHash` does not exist in the database
func (*Database) BlockHeightGroupIndex ¶
func (*Database) BlockIDByDAAScore ¶
func (db *Database) BlockIDByDAAScore(databaseTransaction *pg.Tx, blockDAAScore uint64) (uint64, error)
BlockIDByDAAScore returns the block ID of one block having the closest DAA score to `blockDAAScore`
func (*Database) BlockIDByHash ¶
func (db *Database) BlockIDByHash(databaseTransaction *pg.Tx, blockHash *externalapi.DomainHash) (uint64, error)
blockBaseByHash returns the id of a block idendified by `blockHash`. Returns an error if `blockHash` does not exist in the database
func (*Database) BlockIDsAndHeightsByHashes ¶
func (db *Database) BlockIDsAndHeightsByHashes(databaseTransaction *pg.Tx, blockHashes []*externalapi.DomainHash) ([]uint64, []uint64, error)
BlockIDsAndHeightsByHashes returns two arrays, one of ids and one of heights for `blockHashes` hashes
func (*Database) BlockIDsByHashes ¶
func (db *Database) BlockIDsByHashes(databaseTransaction *pg.Tx, blockHashes []*externalapi.DomainHash) ([]uint64, error)
BlockIDsByHashes returns an arrays of ids for `blockHashes` hashes. Returns an error if any hash in `blockHash` does not exist in the database
func (*Database) DoesBlockExist ¶
func (db *Database) DoesBlockExist(databaseTransaction *pg.Tx, blockHash *externalapi.DomainHash) (bool, error)
func (*Database) FindLatestStoredBlockIndex ¶
func (db *Database) FindLatestStoredBlockIndex(databaseTransaction *pg.Tx, blockHashes []*externalapi.DomainHash) (int, error)
FindLatestStoredBlockIndex returns the index in a DAG ordered block hash array `blockHashes` of the latest block hash that is stored in the database
func (*Database) GetAppConfig ¶
GetAppConfig returns the stored app config. Returns an error if no app config does exist in the database.
func (*Database) GetBlock ¶
GetBlock returns a block identified by `id`. Returns an error if the block `id` does not exist
func (*Database) HashesToBlockIDs ¶
func (db *Database) HashesToBlockIDs(databaseTransaction *pg.Tx, blockHashes []*externalapi.DomainHash) ([]uint64, []*externalapi.DomainHash)
HashesToBlockIDs returns an arrays of ids for `blockHashes` hashes and all the hashes having no matching ID.
func (*Database) HeightGroupSize ¶
func (*Database) HighestBlockHeight ¶
func (*Database) HighestBlockInVirtualSelectedParentChain ¶
func (*Database) InsertBlock ¶
func (db *Database) InsertBlock(databaseTransaction *pg.Tx, blockHash *externalapi.DomainHash, block *model.Block) error
func (*Database) InsertEdge ¶
func (*Database) InsertOrUpdateHeightGroup ¶
func (*Database) LoadCache ¶
Load block infos into the memory cache for all blocks having a height geater or equal to minHeight
func (*Database) RunInTransaction ¶
func (*Database) StoreAppConfig ¶
StoreAppConfig stores an AppConfig in the database. ID is forced to true, this is the only accepted value by the database. Consequently, the database stores at most one AppConfig row.
func (*Database) UpdateBlockColors ¶
func (*Database) UpdateBlockDAAScores ¶
func (db *Database) UpdateBlockDAAScores(databaseTransaction *pg.Tx, blockIDsToDAAScores map[uint64]uint64) error
UpdateBlockDAAScores updates DAA Scores of block ids