mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-01 00:31:21 +00:00
parent
1ac7357005
commit
3c52757526
@ -81,10 +81,11 @@ type DBVerbosityLvl int8
|
|||||||
type Label uint8
|
type Label uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ChainDB Label = 0
|
ChainDB Label = 0
|
||||||
TxPoolDB Label = 1
|
TxPoolDB Label = 1
|
||||||
SentryDB Label = 2
|
SentryDB Label = 2
|
||||||
ConsensusDB Label = 3
|
ConsensusDB Label = 3
|
||||||
|
DownloaderDB Label = 4
|
||||||
)
|
)
|
||||||
|
|
||||||
func (l Label) String() string {
|
func (l Label) String() string {
|
||||||
@ -97,6 +98,8 @@ func (l Label) String() string {
|
|||||||
return "sentry"
|
return "sentry"
|
||||||
case ConsensusDB:
|
case ConsensusDB:
|
||||||
return "consensus"
|
return "consensus"
|
||||||
|
case DownloaderDB:
|
||||||
|
return "downloader"
|
||||||
default:
|
default:
|
||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
|
@ -249,8 +249,7 @@ func (opts MdbxOpts) Open() (kv.RwDB, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if opts.roTxsLimiter == nil {
|
if opts.roTxsLimiter == nil {
|
||||||
|
opts.roTxsLimiter = make(chan struct{}, runtime.GOMAXPROCS(-1))
|
||||||
opts.roTxsLimiter = make(chan struct{}, runtime.NumCPU())
|
|
||||||
}
|
}
|
||||||
db := &MdbxKV{
|
db := &MdbxKV{
|
||||||
opts: opts,
|
opts: opts,
|
||||||
|
@ -32,7 +32,9 @@ func New() kv.RwDB {
|
|||||||
func NewPoolDB() kv.RwDB {
|
func NewPoolDB() kv.RwDB {
|
||||||
return mdbx.NewMDBX(log.New()).InMem().Label(kv.TxPoolDB).WithTablessCfg(func(_ kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }).MustOpen()
|
return mdbx.NewMDBX(log.New()).InMem().Label(kv.TxPoolDB).WithTablessCfg(func(_ kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }).MustOpen()
|
||||||
}
|
}
|
||||||
|
func NewDownloaderDB() kv.RwDB {
|
||||||
|
return mdbx.NewMDBX(log.New()).InMem().Label(kv.DownloaderDB).WithTablessCfg(func(_ kv.TableCfg) kv.TableCfg { return kv.DownloaderTablesCfg }).MustOpen()
|
||||||
|
}
|
||||||
func NewSentryDB() kv.RwDB {
|
func NewSentryDB() kv.RwDB {
|
||||||
return mdbx.NewMDBX(log.New()).InMem().Label(kv.SentryDB).WithTablessCfg(func(_ kv.TableCfg) kv.TableCfg { return kv.SentryTablesCfg }).MustOpen()
|
return mdbx.NewMDBX(log.New()).InMem().Label(kv.SentryDB).WithTablessCfg(func(_ kv.TableCfg) kv.TableCfg { return kv.SentryTablesCfg }).MustOpen()
|
||||||
}
|
}
|
||||||
@ -51,6 +53,13 @@ func NewTestPoolDB(tb testing.TB) kv.RwDB {
|
|||||||
return db
|
return db
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewTestDownloaderDB(tb testing.TB) kv.RwDB {
|
||||||
|
tb.Helper()
|
||||||
|
db := NewDownloaderDB()
|
||||||
|
tb.Cleanup(db.Close)
|
||||||
|
return db
|
||||||
|
}
|
||||||
|
|
||||||
func NewTestSentrylDB(tb testing.TB) kv.RwDB {
|
func NewTestSentrylDB(tb testing.TB) kv.RwDB {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
db := NewPoolDB()
|
db := NewPoolDB()
|
||||||
|
21
kv/tables.go
21
kv/tables.go
@ -205,9 +205,7 @@ const TrieOfStorage = "TrieStorage"
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// DatabaseInfo is used to store information about data layout.
|
// DatabaseInfo is used to store information about data layout.
|
||||||
DatabaseInfo = "DbInfo"
|
DatabaseInfo = "DbInfo"
|
||||||
SnapshotInfo = "SnapshotInfo"
|
|
||||||
BittorrentInfo = "BittorrentInfo"
|
|
||||||
|
|
||||||
// Data item prefixes (use single byte to avoid mixing data types, avoid `i`, used for indexes).
|
// Data item prefixes (use single byte to avoid mixing data types, avoid `i`, used for indexes).
|
||||||
HeaderNumber = "HeaderNumber" // header_hash -> num_u64
|
HeaderNumber = "HeaderNumber" // header_hash -> num_u64
|
||||||
@ -326,6 +324,10 @@ const (
|
|||||||
BorReceipts = "BorReceipt"
|
BorReceipts = "BorReceipt"
|
||||||
BorTxLookup = "BlockBorTransactionLookup"
|
BorTxLookup = "BlockBorTransactionLookup"
|
||||||
BorSeparate = "BorSeparate"
|
BorSeparate = "BorSeparate"
|
||||||
|
|
||||||
|
// Downloader
|
||||||
|
BittorrentCompletion = "BittorrentCompletion"
|
||||||
|
BittorrentInfo = "BittorrentInfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
@ -387,7 +389,6 @@ var ChaindataTables = []string{
|
|||||||
Migrations,
|
Migrations,
|
||||||
LogTopicIndex,
|
LogTopicIndex,
|
||||||
LogAddressIndex,
|
LogAddressIndex,
|
||||||
SnapshotInfo,
|
|
||||||
CallTraceSet,
|
CallTraceSet,
|
||||||
CallFromIndex,
|
CallFromIndex,
|
||||||
CallToIndex,
|
CallToIndex,
|
||||||
@ -401,7 +402,6 @@ var ChaindataTables = []string{
|
|||||||
TrieOfStorage,
|
TrieOfStorage,
|
||||||
HashedAccounts,
|
HashedAccounts,
|
||||||
HashedStorage,
|
HashedStorage,
|
||||||
BittorrentInfo,
|
|
||||||
HeaderCanonical,
|
HeaderCanonical,
|
||||||
Headers,
|
Headers,
|
||||||
HeaderTD,
|
HeaderTD,
|
||||||
@ -429,6 +429,10 @@ var TxPoolTables = []string{
|
|||||||
PoolInfo,
|
PoolInfo,
|
||||||
}
|
}
|
||||||
var SentryTables = []string{}
|
var SentryTables = []string{}
|
||||||
|
var DownloaderTables = []string{
|
||||||
|
BittorrentCompletion,
|
||||||
|
BittorrentInfo,
|
||||||
|
}
|
||||||
|
|
||||||
// ChaindataDeprecatedTables - list of buckets which can be programmatically deleted - for example after migration
|
// ChaindataDeprecatedTables - list of buckets which can be programmatically deleted - for example after migration
|
||||||
var ChaindataDeprecatedTables = []string{
|
var ChaindataDeprecatedTables = []string{
|
||||||
@ -496,6 +500,7 @@ var ChaindataTablesCfg = TableCfg{
|
|||||||
|
|
||||||
var TxpoolTablesCfg = TableCfg{}
|
var TxpoolTablesCfg = TableCfg{}
|
||||||
var SentryTablesCfg = TableCfg{}
|
var SentryTablesCfg = TableCfg{}
|
||||||
|
var DownloaderTablesCfg = TableCfg{}
|
||||||
|
|
||||||
func sortBuckets() {
|
func sortBuckets() {
|
||||||
sort.SliceStable(ChaindataTables, func(i, j int) bool {
|
sort.SliceStable(ChaindataTables, func(i, j int) bool {
|
||||||
@ -541,4 +546,10 @@ func reinit() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, name := range DownloaderTables {
|
||||||
|
_, ok := DownloaderTablesCfg[name]
|
||||||
|
if !ok {
|
||||||
|
DownloaderTablesCfg[name] = TableCfgItem{}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user