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