Skip to content

Commit

Permalink
Merge pull request #773 from iotaledger/chore/update-hive
Browse files Browse the repository at this point in the history
Adapt to latest hive.go changes
  • Loading branch information
muXxer authored Feb 23, 2024
2 parents 28dea81 + 626da43 commit 410e6e9
Show file tree
Hide file tree
Showing 14 changed files with 119 additions and 111 deletions.
4 changes: 2 additions & 2 deletions components/debugapi/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"go.uber.org/dig"

"github.com/iotaledger/hive.go/app"
"github.com/iotaledger/hive.go/db"
"github.com/iotaledger/hive.go/ds/shrinkingmap"
hivedb "github.com/iotaledger/hive.go/kvstore/database"
"github.com/iotaledger/hive.go/lo"
"github.com/iotaledger/hive.go/runtime/event"
"github.com/iotaledger/hive.go/runtime/workerpool"
Expand Down Expand Up @@ -78,7 +78,7 @@ func configure() error {

blocksPerSlot = shrinkingmap.New[iotago.SlotIndex, []*blocks.Block]()
blocksPrunableStorage = prunable.NewBucketManager(database.Config{
Engine: hivedb.EngineRocksDB,
Engine: db.EngineRocksDB,
Directory: ParamsDebugAPI.Database.Path,

Version: 1,
Expand Down
8 changes: 4 additions & 4 deletions components/p2p/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"github.com/iotaledger/hive.go/app"
"github.com/iotaledger/hive.go/app/configuration"
hivep2p "github.com/iotaledger/hive.go/crypto/p2p"
"github.com/iotaledger/hive.go/db"
"github.com/iotaledger/hive.go/ierrors"
"github.com/iotaledger/hive.go/kvstore"
hivedb "github.com/iotaledger/hive.go/kvstore/database"
"github.com/iotaledger/iota-core/pkg/daemon"
"github.com/iotaledger/iota-core/pkg/network"
"github.com/iotaledger/iota-core/pkg/network/p2p"
Expand Down Expand Up @@ -166,9 +166,9 @@ func provide(c *dig.Container) error {

type p2pDeps struct {
dig.In
DatabaseEngine hivedb.Engine `name:"databaseEngine"`
P2PDatabasePath string `name:"p2pDatabasePath"`
P2PBindMultiAddresses []string `name:"p2pBindMultiAddresses"`
DatabaseEngine db.Engine `name:"databaseEngine"`
P2PDatabasePath string `name:"p2pDatabasePath"`
P2PBindMultiAddresses []string `name:"p2pBindMultiAddresses"`
}

type p2pResult struct {
Expand Down
8 changes: 4 additions & 4 deletions components/protocol/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"go.uber.org/dig"

"github.com/iotaledger/hive.go/app"
"github.com/iotaledger/hive.go/db"
"github.com/iotaledger/hive.go/ierrors"
hivedb "github.com/iotaledger/hive.go/kvstore/database"
"github.com/iotaledger/hive.go/runtime/workerpool"
"github.com/iotaledger/iota-core/pkg/daemon"
"github.com/iotaledger/iota-core/pkg/model"
Expand Down Expand Up @@ -86,13 +86,13 @@ func resetProtocolParameters() {
func initConfigParams(c *dig.Container) error {
type cfgResult struct {
dig.Out
DatabaseEngine hivedb.Engine `name:"databaseEngine"`
DatabaseEngine db.Engine `name:"databaseEngine"`
BaseToken *BaseToken
ProtocolParameters []iotago.ProtocolParameters
}

if err := c.Provide(func() cfgResult {
dbEngine, err := hivedb.EngineFromStringAllowed(ParamsDatabase.Engine, database.AllowedEnginesDefault)
dbEngine, err := db.EngineFromStringAllowed(ParamsDatabase.Engine, database.AllowedEnginesDefault)
if err != nil {
Component.LogPanic(err.Error())
}
Expand All @@ -113,7 +113,7 @@ func provide(c *dig.Container) error {
type protocolDeps struct {
dig.In

DatabaseEngine hivedb.Engine `name:"databaseEngine"`
DatabaseEngine db.Engine `name:"databaseEngine"`
ProtocolParameters []iotago.ProtocolParameters
NetworkManager network.Manager
}
Expand Down
31 changes: 16 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/iotaledger/iota-core

go 1.22
go 1.22.0

replace github.com/goccy/go-graphviz => github.com/alexsporn/go-graphviz v0.0.0-20231011102718-04f10f0a9b59

Expand All @@ -10,19 +10,20 @@ require (
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.1
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/iotaledger/hive.go/ads v0.0.0-20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/app v0.0.0-20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/constraints v0.0.0-20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/crypto v0.0.0-20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/ds v0.0.0-20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/ierrors v0.0.0-20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/kvstore v0.0.0-20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/lo v0.0.0-20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/log v0.0.0-20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/runtime v0.0.0-20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/stringify v0.0.0-20240216135101-261e99d9d84a
github.com/iotaledger/hive.go/ads v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/app v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/constraints v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/crypto v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/db v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/ds v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/ierrors v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/kvstore v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/lo v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/log v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/runtime v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/stringify v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240216141618-d7dfe94bdc1e
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240216141023-6d5f4ef12ac5
github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7
Expand Down Expand Up @@ -62,7 +63,7 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/eclipse/paho.mqtt.golang v1.4.3 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/ethereum/go-ethereum v1.13.12 // indirect
github.com/ethereum/go-ethereum v1.13.13 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/fjl/memsize v0.0.2 // indirect
Expand Down
58 changes: 30 additions & 28 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum/go-ethereum v1.13.12 h1:iDr9UM2JWkngBHGovRJEQn4Kor7mT4gt9rUZqB5M29Y=
github.com/ethereum/go-ethereum v1.13.12/go.mod h1:hKL2Qcj1OvStXNSEDbucexqnEt1Wh4Cz329XsjAalZY=
github.com/ethereum/go-ethereum v1.13.13 h1:KYn9w7pEWRI9oyZOzO94OVbctSusPByHdFDPj634jII=
github.com/ethereum/go-ethereum v1.13.13/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
Expand Down Expand Up @@ -277,32 +277,34 @@ github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJ
github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w=
github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PTNgli6EbS4tV9qu3QAm/kBU3XaYZV2xdzys=
github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw=
github.com/iotaledger/hive.go/ads v0.0.0-20240216135101-261e99d9d84a h1:lfHr3XqlJbScsEgj62LX1SRypjTuSPOJfMcUUInypno=
github.com/iotaledger/hive.go/ads v0.0.0-20240216135101-261e99d9d84a/go.mod h1:4bUdqpUden+8RL2WZGzDJqYjOO6JrYZ2L1isp/2lVss=
github.com/iotaledger/hive.go/app v0.0.0-20240216135101-261e99d9d84a h1:o5viyYlzi6kgClLNgUW5Pay0tXMylc0FPivYgSlAc4g=
github.com/iotaledger/hive.go/app v0.0.0-20240216135101-261e99d9d84a/go.mod h1:O9agBfrnt1ykrDOzF6GXZf4ivcw+SxM9c9C86YtbxLU=
github.com/iotaledger/hive.go/constraints v0.0.0-20240216135101-261e99d9d84a h1:9xeffzciYdw9L/ebAOPg/39Bqn3p5iyOROQhQHaAEUs=
github.com/iotaledger/hive.go/constraints v0.0.0-20240216135101-261e99d9d84a/go.mod h1:JF7jjkL6tSUOXm23SWadBzBrl7eJk1DQRLc/fNoVZ+o=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240216135101-261e99d9d84a h1:+l3NjL4v700Iv+ZF7KjPALkygFOxzkByoRIoSK9bOzc=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240216135101-261e99d9d84a/go.mod h1:9HM/YmzOfdlWXYHVEWVjYhKQHOlgxBVMsr5Vf5yn5IE=
github.com/iotaledger/hive.go/crypto v0.0.0-20240216135101-261e99d9d84a h1:ux81+J6mcxYw6usZpEPLZjE6J+TNs3RaRcTHa9+5ERM=
github.com/iotaledger/hive.go/crypto v0.0.0-20240216135101-261e99d9d84a/go.mod h1:7kZh98nwJInQsIybiPXSABc/on/IsDdXyeiPLfaH+2I=
github.com/iotaledger/hive.go/ds v0.0.0-20240216135101-261e99d9d84a h1:7M1+k0H53jahg2ZDN10SociepCB+jymIZoiYaSenpbQ=
github.com/iotaledger/hive.go/ds v0.0.0-20240216135101-261e99d9d84a/go.mod h1:sE/HabIH9FWTvgaHioLN6o4rrxFMf4BuqRQwloxcamo=
github.com/iotaledger/hive.go/ierrors v0.0.0-20240216135101-261e99d9d84a h1:ugcQ43xbMZo5XYTfanIHOxQGKNpxhcatcz9ZXcX6W1o=
github.com/iotaledger/hive.go/ierrors v0.0.0-20240216135101-261e99d9d84a/go.mod h1:GQY0/35sjgT9Poi1Vrs9kFVvAkuKzGXfVh4j6CBXsAA=
github.com/iotaledger/hive.go/kvstore v0.0.0-20240216135101-261e99d9d84a h1:Lszz1ySzHxYKb/QB3+/Ug4WklVgVKCA84u4PB0XK6TM=
github.com/iotaledger/hive.go/kvstore v0.0.0-20240216135101-261e99d9d84a/go.mod h1:vgJh/0OelY+SHdWsdo0kXOYciHu8UA9OAi2FbJgVQsc=
github.com/iotaledger/hive.go/lo v0.0.0-20240216135101-261e99d9d84a h1:eUAtyEIYRlAPeZ2qhlEA+7T8DVoYK2h9eotlst/84SU=
github.com/iotaledger/hive.go/lo v0.0.0-20240216135101-261e99d9d84a/go.mod h1:0ycE1W59kkNjQ87odL6H4x5Ik9bXhbNk88wmo+mIYt0=
github.com/iotaledger/hive.go/log v0.0.0-20240216135101-261e99d9d84a h1:XzIuUsWPtDP7h9UbQPFW5/bjeqVjodcSCMRuF7zP5jk=
github.com/iotaledger/hive.go/log v0.0.0-20240216135101-261e99d9d84a/go.mod h1:JCv/LVVTAMoCPLzou534RoIif7CAezcWZlGYabrHsck=
github.com/iotaledger/hive.go/runtime v0.0.0-20240216135101-261e99d9d84a h1:qmfoYLK2XyPOXfldG21qHyCrbIf0sl7iJoFirvTrnO0=
github.com/iotaledger/hive.go/runtime v0.0.0-20240216135101-261e99d9d84a/go.mod h1:lAR3vbqE9g65M9VwWHiaXab2q+d89dBOFjhKgnDfK7c=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240216135101-261e99d9d84a h1:ahUFo0X9Th+8/aE6KSWiy7Eap5p0YFL6CDapP1o8dLo=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240216135101-261e99d9d84a/go.mod h1:yXQNGZUz++dB1T9RAHhWSresuTLzTC856ntdins9ivo=
github.com/iotaledger/hive.go/stringify v0.0.0-20240216135101-261e99d9d84a h1:xLreq/rXeSPdb86RnZNEPH3PUIWt56BQxK1+11+hM4I=
github.com/iotaledger/hive.go/stringify v0.0.0-20240216135101-261e99d9d84a/go.mod h1:O4p7UmsfoeLqtAUwrKbq0lXMxjY/MLQSpZSavvvvGig=
github.com/iotaledger/hive.go/ads v0.0.0-20240223142044-12ffcb37c413 h1:W1huTr6Xf/a/JtXpoBnrPtx/2cSvESGAzAlFsOiUUBE=
github.com/iotaledger/hive.go/ads v0.0.0-20240223142044-12ffcb37c413/go.mod h1:tkWq2sJR/vWkbht1BJNIvNP6hJAaRye99wid0A2oU9I=
github.com/iotaledger/hive.go/app v0.0.0-20240223142044-12ffcb37c413 h1:+a11iU2tJrQthoU4N4UPls008IBFamfepeb7EKHjZ6E=
github.com/iotaledger/hive.go/app v0.0.0-20240223142044-12ffcb37c413/go.mod h1:EMUpj6oDb/QSiVpIe5nYwyDKSpO6ue7mdkzmK/VoBn8=
github.com/iotaledger/hive.go/constraints v0.0.0-20240223142044-12ffcb37c413 h1:WWuXcr//V/8aZNW64TJ9delPMgVzxAgcHL5aV/bi5Ko=
github.com/iotaledger/hive.go/constraints v0.0.0-20240223142044-12ffcb37c413/go.mod h1:JF7jjkL6tSUOXm23SWadBzBrl7eJk1DQRLc/fNoVZ+o=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240223142044-12ffcb37c413 h1:iav0P4TvMmEkbG/bryl0p8GKeIebuXchdIMS4GuJufI=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240223142044-12ffcb37c413/go.mod h1:73ODTHUJxAoGUN0InOtuQ29LVq85pDf7GckM9d0ziqo=
github.com/iotaledger/hive.go/crypto v0.0.0-20240223142044-12ffcb37c413 h1:1GR1t/N5bUCH38oN6fJD2JcRSOf8yAhiDJigqmuCcVQ=
github.com/iotaledger/hive.go/crypto v0.0.0-20240223142044-12ffcb37c413/go.mod h1:aREIB19gIhSYdY0Hl/37sg1JRH7+j3ajeJxBIQf6mig=
github.com/iotaledger/hive.go/db v0.0.0-20240223142044-12ffcb37c413 h1:Q/FcxgM1G/iCY4HYNmuXGg/MIW9Su+9akeiQwYdv2lU=
github.com/iotaledger/hive.go/db v0.0.0-20240223142044-12ffcb37c413/go.mod h1:8Y5vqE5NK5zG4Af0JV2UQeW67iLlymPLsT1KkOn4qY8=
github.com/iotaledger/hive.go/ds v0.0.0-20240223142044-12ffcb37c413 h1:cQsuww6lGaOhVDyrOngWHWMeNKiXPsKkC9fNHFm2EDE=
github.com/iotaledger/hive.go/ds v0.0.0-20240223142044-12ffcb37c413/go.mod h1:wfjeJj9B+MM/3yeUHfvT8Gj8bRsdl9utyh2dZg+1+B0=
github.com/iotaledger/hive.go/ierrors v0.0.0-20240223142044-12ffcb37c413 h1:Cf9Bfs+mEyuExJ1HwWTzbaRWQ+tEF8sTxon5/fGUUsk=
github.com/iotaledger/hive.go/ierrors v0.0.0-20240223142044-12ffcb37c413/go.mod h1:GQY0/35sjgT9Poi1Vrs9kFVvAkuKzGXfVh4j6CBXsAA=
github.com/iotaledger/hive.go/kvstore v0.0.0-20240223142044-12ffcb37c413 h1:++phKVwS67vXo/3D6FNWAVaQ393a2E3ys9g+C/8zK0I=
github.com/iotaledger/hive.go/kvstore v0.0.0-20240223142044-12ffcb37c413/go.mod h1:dCgv8YMOihhGNxQu37Vh5XqT/7wLbIJst2WePqo1z8Y=
github.com/iotaledger/hive.go/lo v0.0.0-20240223142044-12ffcb37c413 h1:uSEoXnPE3FjeV9RNZNqIZTTb8v/8EGBMw1rbaiC3x9M=
github.com/iotaledger/hive.go/lo v0.0.0-20240223142044-12ffcb37c413/go.mod h1:67oLzWYiBLGt5PN7IBVHdbt9P6oBYCx9UvMEL8ExDAc=
github.com/iotaledger/hive.go/log v0.0.0-20240223142044-12ffcb37c413 h1:4xKFtHoOy1YCnq6g8T7Dr+a3tDGG338yLDXRSichwE4=
github.com/iotaledger/hive.go/log v0.0.0-20240223142044-12ffcb37c413/go.mod h1:H5tmswUbT3o5+QiM6UPtBv7VnPf+lJtlantgpp2lzUI=
github.com/iotaledger/hive.go/runtime v0.0.0-20240223142044-12ffcb37c413 h1:7O3oSoXlwV5L3/+kt/a1MN3Kwb5oXaaSZaa+aabh7BM=
github.com/iotaledger/hive.go/runtime v0.0.0-20240223142044-12ffcb37c413/go.mod h1:pueoYXud+HmTY2x9j/S6+ZX3M5ZyENFKPDrx3EtcwWs=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240223142044-12ffcb37c413 h1:tQW0K9Ogyfgm3V0wYhRPChOYgrADGlRWF6P4gMY8Zbg=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240223142044-12ffcb37c413/go.mod h1:NK05G4PxwZF1m4jGANJWLhAQ2hP1Nt0L8mgCTFLsSCw=
github.com/iotaledger/hive.go/stringify v0.0.0-20240223142044-12ffcb37c413 h1:QCidFFczZH9NEJTWm0ZzZKMaQ0XUxYyU00dpaH+skqs=
github.com/iotaledger/hive.go/stringify v0.0.0-20240223142044-12ffcb37c413/go.mod h1:O4p7UmsfoeLqtAUwrKbq0lXMxjY/MLQSpZSavvvvGig=
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240216141618-d7dfe94bdc1e h1:I6KnVRg96X7mL1k/h3xovdJL3I31q8C6wPiUJanvOdY=
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240216141618-d7dfe94bdc1e/go.mod h1:rCLE9iv2S0qiL4s7TPj/2ieTLhV2m0Nor3g2JJHhu6M=
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240216141023-6d5f4ef12ac5 h1:ebh2IKHPVG/qMjTk56hIBG9DcZ0XN02pP8UJ+vB2IpM=
Expand Down
2 changes: 1 addition & 1 deletion pkg/protocol/commitments.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (c *Commitments) publishCommitment(commitment *model.Commitment) (published
func (c *Commitments) cachedRequest(commitmentID iotago.CommitmentID, requestIfMissing ...bool) *promise.Promise[*Commitment] {
// handle evicted slots
slotEvicted := c.protocol.EvictionEvent(commitmentID.Index())
if slotEvicted.WasTriggered() && c.protocol.LastEvictedSlot().Get() != 0 {
if slotEvicted.WasTriggered() && c.protocol.LastEvictedSlot() != 0 {
return promise.New[*Commitment]().Reject(ErrorSlotEvicted)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

"github.com/stretchr/testify/require"

"github.com/iotaledger/hive.go/db"
"github.com/iotaledger/hive.go/ds/shrinkingmap"
"github.com/iotaledger/hive.go/kvstore"
hivedb "github.com/iotaledger/hive.go/kvstore/database"
"github.com/iotaledger/hive.go/kvstore/mapdb"
"github.com/iotaledger/hive.go/lo"
"github.com/iotaledger/iota-core/pkg/core/account"
Expand Down Expand Up @@ -49,7 +49,7 @@ func NewTestFramework(test *testing.T) *TestFramework {
}

prunableStorage := prunable.New(database.Config{
Engine: hivedb.EngineMapDB,
Engine: db.EngineMapDB,
Directory: t.TempDir(),
}, iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI), func(err error) { panic(err) })

Expand Down
4 changes: 2 additions & 2 deletions pkg/protocol/engine/eviction/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package eviction_test
import (
"testing"

hivedb "github.com/iotaledger/hive.go/kvstore/database"
"github.com/iotaledger/hive.go/db"
"github.com/iotaledger/hive.go/kvstore/mapdb"
"github.com/iotaledger/iota-core/pkg/protocol/engine/eviction"
"github.com/iotaledger/iota-core/pkg/storage/database"
Expand All @@ -25,7 +25,7 @@ func TestState_RootBlocks(t *testing.T) {
))

prunableStorage := prunable.New(database.Config{
Engine: hivedb.EngineMapDB,
Engine: db.EngineMapDB,
Directory: t.TempDir(),
}, iotago.SingleVersionProvider(tpkg.ZeroCostTestAPI), errorHandler)

Expand Down
6 changes: 4 additions & 2 deletions pkg/storage/database/config.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package database

import hivedb "github.com/iotaledger/hive.go/kvstore/database"
import (
"github.com/iotaledger/hive.go/db"
)

type Config struct {
Engine hivedb.Engine
Engine db.Engine
Directory string
Version byte
PrefixHealth []byte
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"encoding/json"
"time"

hivedb "github.com/iotaledger/hive.go/db"
"github.com/iotaledger/hive.go/ierrors"
"github.com/iotaledger/hive.go/kvstore"
hivedb "github.com/iotaledger/hive.go/kvstore/database"
"github.com/iotaledger/hive.go/kvstore/mapdb"
"github.com/iotaledger/hive.go/kvstore/rocksdb"
"github.com/iotaledger/hive.go/runtime/event"
Expand Down
6 changes: 3 additions & 3 deletions pkg/storage/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ package storage
import (
"time"

hivedb "github.com/iotaledger/hive.go/kvstore/database"
"github.com/iotaledger/hive.go/db"
"github.com/iotaledger/hive.go/runtime/options"
"github.com/iotaledger/iota-core/pkg/storage/permanent"
"github.com/iotaledger/iota-core/pkg/storage/prunable"
iotago "github.com/iotaledger/iota.go/v4"
)

func WithDBEngine(optsDBEngine hivedb.Engine) options.Option[Storage] {
func WithDBEngine(optsDBEngine db.Engine) options.Option[Storage] {
return func(s *Storage) {
s.optsDBEngine = optsDBEngine
}
}

func WithAllowedDBEngines(optsAllowedDBEngines []hivedb.Engine) options.Option[Storage] {
func WithAllowedDBEngines(optsAllowedDBEngines []db.Engine) options.Option[Storage] {
return func(s *Storage) {
s.optsAllowedDBEngines = optsAllowedDBEngines
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"sync"
"time"

"github.com/iotaledger/hive.go/db"
"github.com/iotaledger/hive.go/ds/reactive"
"github.com/iotaledger/hive.go/ierrors"
hivedb "github.com/iotaledger/hive.go/kvstore/database"
"github.com/iotaledger/hive.go/runtime/event"
"github.com/iotaledger/hive.go/runtime/options"
"github.com/iotaledger/iota-core/pkg/model"
Expand Down Expand Up @@ -46,8 +46,8 @@ type Storage struct {
lastPrunedSizeTime time.Time
lastAccessedBlocks reactive.Variable[iotago.SlotIndex]

optsDBEngine hivedb.Engine
optsAllowedDBEngines []hivedb.Engine
optsDBEngine db.Engine
optsAllowedDBEngines []db.Engine
optsPruningDelay iotago.EpochIndex
optPruningSizeEnabled bool
optsPruningSizeMaxTargetSizeBytes int64
Expand All @@ -65,7 +65,7 @@ func New(directory string, errorHandler func(error), opts ...options.Option[Stor
errorHandler: errorHandler,
lastPrunedEpoch: model.NewEvictionIndex[iotago.EpochIndex](),
lastAccessedBlocks: reactive.NewVariable[iotago.SlotIndex](),
optsDBEngine: hivedb.EngineRocksDB,
optsDBEngine: db.EngineRocksDB,
optsPruningDelay: 30,
optPruningSizeEnabled: false,
optsPruningSizeMaxTargetSizeBytes: 30 * 1024 * 1024 * 1024, // 30GB
Expand Down
Loading

0 comments on commit 410e6e9

Please sign in to comment.