This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 55
fixing namespace seeding issue #241
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1ea20f5
fixing namespace seeding issue
nitro-neal 0188105
Merge branch 'main' into bolt-namespace-issue
decentralgabe b918a65
returning nil instead of error if no namespace exists
nitro-neal 98ec813
adding unit test
nitro-neal 3e2cd95
removing logs
nitro-neal 6ec9c9d
Merge branch 'main' into bolt-namespace-issue
nitro-neal 9e6c47f
add logs back
nitro-neal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ import ( | |
|
||
"github.com/goccy/go-json" | ||
"github.com/pkg/errors" | ||
"github.com/sirupsen/logrus" | ||
"github.com/tbd54566975/ssi-service/internal/util" | ||
bolt "go.etcd.io/bbolt" | ||
) | ||
|
@@ -90,7 +89,6 @@ func (b *BoltDB) Read(namespace, key string) ([]byte, error) { | |
err := b.db.View(func(tx *bolt.Tx) error { | ||
bucket := tx.Bucket([]byte(namespace)) | ||
if bucket == nil { | ||
logrus.Infof("namespace<%s> does not exist", namespace) | ||
return nil | ||
} | ||
result = bucket.Get([]byte(key)) | ||
|
@@ -105,9 +103,7 @@ func (b *BoltDB) ReadPrefix(namespace, prefix string) (map[string][]byte, error) | |
err := b.db.View(func(tx *bolt.Tx) error { | ||
bucket := tx.Bucket([]byte(namespace)) | ||
if bucket == nil { | ||
errMsg := fmt.Sprintf("namespace<%s> does not exist", namespace) | ||
logrus.Error(errMsg) | ||
return errors.New(errMsg) | ||
return nil | ||
} | ||
cursor := bucket.Cursor() | ||
prefix := []byte(prefix) | ||
|
@@ -124,7 +120,6 @@ func (b *BoltDB) ReadAll(namespace string) (map[string][]byte, error) { | |
err := b.db.View(func(tx *bolt.Tx) error { | ||
bucket := tx.Bucket([]byte(namespace)) | ||
if bucket == nil { | ||
logrus.Errorf("namespace<%s> does not exist", namespace) | ||
return nil | ||
} | ||
cursor := bucket.Cursor() | ||
|
@@ -141,7 +136,7 @@ func (b *BoltDB) ReadAllKeys(namespace string) ([]string, error) { | |
err := b.db.View(func(tx *bolt.Tx) error { | ||
bucket := tx.Bucket([]byte(namespace)) | ||
if bucket == nil { | ||
return util.LoggingNewErrorf("namespace<%s> does not exist", namespace) | ||
return nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would keep the error as a warn or info |
||
} | ||
cursor := bucket.Cursor() | ||
for k, _ := cursor.First(); k != nil; k, _ = cursor.Next() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍