Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrated cacheless core #31

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.20
require (
github.com/hashicorp/golang-lru v0.6.0
github.com/multiversx/concurrent-map v0.1.4
github.com/multiversx/mx-chain-core-go v1.2.16
github.com/multiversx/mx-chain-logger-go v1.0.13
github.com/multiversx/mx-chain-core-go v1.2.19-0.20231129100534-356aa234f4ff
github.com/multiversx/mx-chain-logger-go v1.0.14-0.20231129101244-c44fa1c79b03
github.com/stretchr/testify v1.7.2
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d
)
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/multiversx/concurrent-map v0.1.4 h1:hdnbM8VE4b0KYJaGY5yJS2aNIW9TFFsUYwbO0993uPI=
github.com/multiversx/concurrent-map v0.1.4/go.mod h1:8cWFRJDOrWHOTNSqgYCUvwT7c7eFQ4U2vKMOp4A/9+o=
github.com/multiversx/mx-chain-core-go v1.2.16 h1:m0hUNmZQjGJxKDLQOHoM9jSaeDfVTbyd+mqiS8+NckE=
github.com/multiversx/mx-chain-core-go v1.2.16/go.mod h1:BILOGHUOIG5dNNX8cgkzCNfDaVtoYrJRYcPnpxRMH84=
github.com/multiversx/mx-chain-logger-go v1.0.13 h1:eru/TETo0MkO4ZTnXsQDKf4PBRpAXmqjT02klNT/JnY=
github.com/multiversx/mx-chain-logger-go v1.0.13/go.mod h1:MZJhTAtZTJxT+yK2EHc4ZW3YOHUc1UdjCD0iahRNBZk=
github.com/multiversx/mx-chain-core-go v1.2.19-0.20231129100534-356aa234f4ff h1:Iss44e+2C4vGtQ5sU3lOqDQ+dxvwlO+Z3mSbC8T1J64=
github.com/multiversx/mx-chain-core-go v1.2.19-0.20231129100534-356aa234f4ff/go.mod h1:B5zU4MFyJezmEzCsAHE9YNULmGCm2zbPHvl9hazNxmE=
github.com/multiversx/mx-chain-logger-go v1.0.14-0.20231129101244-c44fa1c79b03 h1:krjJTyN9jrFTK0goMGFdgvJGy6bYSqe8EtI/HCceUmU=
github.com/multiversx/mx-chain-logger-go v1.0.14-0.20231129101244-c44fa1c79b03/go.mod h1:fH/fR/GEBsDjPkBoZDVJMoYo2HhlA7++DP6QfITJ1N8=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down
4 changes: 2 additions & 2 deletions lrucache/lrucache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"time"

"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/storage"
"github.com/multiversx/mx-chain-storage-go/common"
"github.com/multiversx/mx-chain-storage-go/lrucache"
"github.com/multiversx/mx-chain-storage-go/types"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -421,7 +421,7 @@ func TestLRUCache_CloseShouldNotErr(t *testing.T) {
}

type cacheWrapper struct {
c storage.Cacher
c types.Cacher
}

func newCacheWrapper() *cacheWrapper {
Expand Down
4 changes: 2 additions & 2 deletions storageUnit/nilStorer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package storageUnit

import (
storageCore "github.com/multiversx/mx-chain-core-go/storage"
"github.com/multiversx/mx-chain-core-go/data"
"github.com/multiversx/mx-chain-storage-go/common"
)

Expand All @@ -20,7 +20,7 @@ func (ns *NilStorer) GetFromEpoch(_ []byte, _ uint32) ([]byte, error) {
}

// GetBulkFromEpoch will do nothing
func (ns *NilStorer) GetBulkFromEpoch(_ [][]byte, _ uint32) ([]storageCore.KeyValuePair, error) {
func (ns *NilStorer) GetBulkFromEpoch(_ [][]byte, _ uint32) ([]data.KeyValuePair, error) {
return nil, nil
}

Expand Down
8 changes: 4 additions & 4 deletions storageUnit/storageunit.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"time"

"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/data"
"github.com/multiversx/mx-chain-core-go/hashing"
"github.com/multiversx/mx-chain-core-go/hashing/blake2b"
"github.com/multiversx/mx-chain-core-go/hashing/fnv"
"github.com/multiversx/mx-chain-core-go/hashing/keccak"
storageCore "github.com/multiversx/mx-chain-core-go/storage"
logger "github.com/multiversx/mx-chain-logger-go"
"github.com/multiversx/mx-chain-storage-go/common"
"github.com/multiversx/mx-chain-storage-go/fifocache"
Expand Down Expand Up @@ -200,8 +200,8 @@ func (u *Unit) GetFromEpoch(key []byte, _ uint32) ([]byte, error) {
}

// GetBulkFromEpoch will call the Get method for all keys as this storer doesn't handle epochs
func (u *Unit) GetBulkFromEpoch(keys [][]byte, _ uint32) ([]storageCore.KeyValuePair, error) {
results := make([]storageCore.KeyValuePair, 0, len(keys))
func (u *Unit) GetBulkFromEpoch(keys [][]byte, _ uint32) ([]data.KeyValuePair, error) {
results := make([]data.KeyValuePair, 0, len(keys))
for _, key := range keys {
value, err := u.Get(key)
if err != nil {
Expand All @@ -211,7 +211,7 @@ func (u *Unit) GetBulkFromEpoch(keys [][]byte, _ uint32) ([]storageCore.KeyValue
)
continue
}
keyValue := storageCore.KeyValuePair{Key: key, Value: value}
keyValue := data.KeyValuePair{Key: key, Value: value}
results = append(results, keyValue)
}
return results, nil
Expand Down
4 changes: 2 additions & 2 deletions types/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package types
import (
"time"

"github.com/multiversx/mx-chain-core-go/storage"
"github.com/multiversx/mx-chain-core-go/data"
)

// Persister provides storage of data services in a database like construct
Expand Down Expand Up @@ -94,7 +94,7 @@ type Storer interface {
ClearCache()
DestroyUnit() error
GetFromEpoch(key []byte, epoch uint32) ([]byte, error)
GetBulkFromEpoch(keys [][]byte, epoch uint32) ([]storage.KeyValuePair, error)
GetBulkFromEpoch(keys [][]byte, epoch uint32) ([]data.KeyValuePair, error)
GetOldestEpoch() (uint32, error)
RangeKeys(handler func(key []byte, val []byte) bool)
Close() error
Expand Down