Documentation ¶
Overview ¶
Package model define archive db model
Index ¶
- Constants
- func BlockInfoTableNameByBlockHeight(blkHeight uint64) string
- func CreateBlockInfoTableIfNotExists(db *gorm.DB, tableName string) error
- func DbName(chainId string) string
- func GetArchivedBlockHeight(db *gorm.DB) (uint64, error)
- func InitArchiveStatusData(db *gorm.DB) error
- func InsertBlockInfo(db *gorm.DB, chainId string, blkHeight uint64, blkWithRWSet []byte, ...) error
- func RowsPerBlockInfoTable() uint64
- func UpdateArchivedBlockHeight(db *gorm.DB, archivedBlockHeight uint64) error
- type BaseModel
- type BlockInfo
- type Sysinfo
Constants ¶
View Source
const (
// KArchivedblockheight archived_block_height
KArchivedblockheight = "archived_block_height"
)
Variables ¶
This section is empty.
Functions ¶
func BlockInfoTableNameByBlockHeight ¶
BlockInfoTableNameByBlockHeight Get BlockInfo table name by block height
func CreateBlockInfoTableIfNotExists ¶
CreateBlockInfoTableIfNotExists create table `tableName` if not exists
func GetArchivedBlockHeight ¶
GetArchivedBlockHeight get archived block height from db
func InitArchiveStatusData ¶
InitArchiveStatusData init archive status data @param db @return error
func InsertBlockInfo ¶
func InsertBlockInfo(db *gorm.DB, chainId string, blkHeight uint64, blkWithRWSet []byte, hmac string) error
InsertBlockInfo insert block info into db
Types ¶
type BaseModel ¶
type BaseModel struct { ID int64 `gorm:"primaryKey;column:Fid;type:int unsigned NOT NULL AUTO_INCREMENT"` CreatedAt sql.NullTime `gorm:"index;column:Fcreate_time;type:timestamp"` UpdatedAt sql.NullTime `gorm:"column:Fmodify_time;type:timestamp"` DeletedAt sql.NullTime `gorm:"column:Fdelete_time;type:timestamp"` }
BaseModel define base db model
type BlockInfo ¶
type BlockInfo struct { BaseModel ChainID string `gorm:"column:Fchain_id;type:varchar(64) NOT NULL"` BlockHeight uint64 `gorm:"column:Fblock_height;type:int unsigned NOT NULL;uniqueIndex:idx_blockheight"` BlockWithRWSet []byte `gorm:"column:Fblock_with_rwset;type:longblob NOT NULL"` Hmac string `gorm:"column:Fhmac;type:varchar(64) NOT NULL"` IsArchived bool `gorm:"column:Fis_archived;type:tinyint(1) NOT NULL DEFAULT '0'"` }
BlockInfo define block info db model
Click to show internal directories.
Click to hide internal directories.