Skip to content

Commit

Permalink
INS-1644 fix GetLedgerComponents
Browse files Browse the repository at this point in the history
  • Loading branch information
egorikas committed Feb 27, 2019
1 parent 1e3aac3 commit 0e991a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
5 changes: 0 additions & 5 deletions configuration/ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ type Ledger struct {
// IMPORTANT: It should be the same on ALL nodes.
LightChainLimit int

// JetSizesHistoryDepth holds maximum number of drop sizes
JetSizesHistoryDepth int

// Exporter holds configuration of Exporter
Exporter Exporter

Expand Down Expand Up @@ -116,8 +113,6 @@ func NewLedger() Ledger {

LightChainLimit: 5, // 5 pulses

JetSizesHistoryDepth: 10,

Exporter: Exporter{
ExportLag: 40, // 40 seconds
},
Expand Down
19 changes: 16 additions & 3 deletions ledger/ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"context"

"github.com/insolar/insolar/ledger/recentstorage"
"github.com/insolar/insolar/ledger/storage/genesis"
"github.com/insolar/insolar/ledger/storage/jet"
"github.com/insolar/insolar/ledger/storage/nodes"
"github.com/pkg/errors"

Expand Down Expand Up @@ -87,25 +89,36 @@ func GetLedgerComponents(conf configuration.Ledger, certificate core.Certificate
}

var pulseTracker storage.PulseTracker
var dropModifier jet.DropModifier
var dropAccessor jet.DropAccessor
// TODO: @imarkin 18.02.18 - Comparision with core.StaticRoleUnknown is a hack for genesis pulse (INS-1537)
switch certificate.GetRole() {
case core.StaticRoleUnknown, core.StaticRoleHeavyMaterial:
pulseTracker = storage.NewPulseTracker()

dbDropStorage := jet.NewDropStorageDB()
dropModifier = dbDropStorage
dropAccessor = dbDropStorage
default:
pulseTracker = storage.NewPulseTrackerMemory()

memoryDropStorage := jet.NewDropStorageMemory()
dropModifier = memoryDropStorage
dropAccessor = memoryDropStorage
}

return []interface{}{
db,
storage.NewCleaner(),
pulseTracker,
storage.NewPulseStorage(),
storage.NewJetStorage(),
storage.NewDropStorage(conf.JetSizesHistoryDepth),
jet.NewJetStorage(),
dropModifier,
dropAccessor,
nodes.NewStorage(),
storage.NewObjectStorage(),
storage.NewReplicaStorage(),
storage.NewGenesisInitializer(),
genesis.NewGenesisInitializer(),
recentstorage.NewRecentStorageProvider(conf.RecentStorage.DefaultTTL),
artifactmanager.NewHotDataWaiterConcrete(),
artifactmanager.NewArtifactManger(),
Expand Down

0 comments on commit 0e991a5

Please sign in to comment.