channeldb: embed the instance of boltb within DB struct
This commit modifies the composition of the boltdb pointer within the DB struct to use embedding. The rationale for this change is that the daemon may soon store some semi-transient items within the database which requires us to expose the boltdb’s transaction API. The logic for serialization of this data will likely lie outside of the channeldb package as the items that may be stored in the future will be specific to the current sub-systems within the daemon and not generic channel related data.
This commit is contained in:
6 files changed
+30
-39
No files matched your search
+3
-3
@@ -104,7 +104,7 @@ func (l *LinkNode) Sync() error {
|
||||
|
||||
// Finally update the database by storing the link node and updating
|
||||
// any relevant indexes.
|
||||
return l.db.store.Update(func(tx *bolt.Tx) error {
|
||||
return l.db.Update(func(tx *bolt.Tx) error {
|
||||
nodeMetaBucket := tx.Bucket(nodeInfoBucket)
|
||||
if nodeInfoBucket == nil {
|
||||
return fmt.Errorf("node bucket not created")
|
||||
@@ -139,7 +139,7 @@ func (db *DB) FetchLinkNode(identity *btcec.PublicKey) (*LinkNode, error) {
|
||||
err error
|
||||
)
|
||||
|
||||
err = db.store.View(func(tx *bolt.Tx) error {
|
||||
err = db.View(func(tx *bolt.Tx) error {
|
||||
// First fetch the bucket for storing node meta-data, bailing
|
||||
// out early if it hasn't been created yet.
|
||||
nodeMetaBucket := tx.Bucket(nodeInfoBucket)
|
||||
@@ -178,7 +178,7 @@ func (db *DB) FetchLinkNode(identity *btcec.PublicKey) (*LinkNode, error) {
|
||||
func (db *DB) FetchAllLinkNodes() ([]*LinkNode, error) {
|
||||
var linkNodes []*LinkNode
|
||||
|
||||
err := db.store.View(func(tx *bolt.Tx) error {
|
||||
err := db.View(func(tx *bolt.Tx) error {
|
||||
nodeMetaBucket := tx.Bucket(nodeInfoBucket)
|
||||
if nodeInfoBucket == nil {
|
||||
return fmt.Errorf("node bucket not created")
|
||||
|
||||
Reference in new issue
Block a user