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
@@ -171,7 +171,7 @@ func TestMigrationWithPanic(t *testing.T) {
|
||||
beforeMigrationFunc := func(d *DB) {
|
||||
// Insert data in database and in order then make sure that the
|
||||
// key isn't changes in case of panic or fail.
|
||||
d.store.Update(func(tx *bolt.Tx) error {
|
||||
d.Update(func(tx *bolt.Tx) error {
|
||||
bucket, err := tx.CreateBucketIfNotExists(bucketPrefix)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -205,7 +205,7 @@ func TestMigrationWithPanic(t *testing.T) {
|
||||
t.Fatal("migration paniced but version is changed")
|
||||
}
|
||||
|
||||
err = d.store.Update(func(tx *bolt.Tx) error {
|
||||
err = d.Update(func(tx *bolt.Tx) error {
|
||||
bucket, err := tx.CreateBucketIfNotExists(bucketPrefix)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -238,7 +238,7 @@ func TestMigrationWithFatal(t *testing.T) {
|
||||
afterMigration := []byte("aftermigration")
|
||||
|
||||
beforeMigrationFunc := func(d *DB) {
|
||||
d.store.Update(func(tx *bolt.Tx) error {
|
||||
d.Update(func(tx *bolt.Tx) error {
|
||||
bucket, err := tx.CreateBucketIfNotExists(bucketPrefix)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -273,7 +273,7 @@ func TestMigrationWithFatal(t *testing.T) {
|
||||
t.Fatal("migration failed but version is changed")
|
||||
}
|
||||
|
||||
err = d.store.Update(func(tx *bolt.Tx) error {
|
||||
err = d.Update(func(tx *bolt.Tx) error {
|
||||
bucket, err := tx.CreateBucketIfNotExists(bucketPrefix)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -307,7 +307,7 @@ func TestMigrationWithoutErrors(t *testing.T) {
|
||||
|
||||
// Populate database with initial data.
|
||||
beforeMigrationFunc := func(d *DB) {
|
||||
d.store.Update(func(tx *bolt.Tx) error {
|
||||
d.Update(func(tx *bolt.Tx) error {
|
||||
bucket, err := tx.CreateBucketIfNotExists(bucketPrefix)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -341,7 +341,7 @@ func TestMigrationWithoutErrors(t *testing.T) {
|
||||
"succesfully aplied migration")
|
||||
}
|
||||
|
||||
err = d.store.Update(func(tx *bolt.Tx) error {
|
||||
err = d.Update(func(tx *bolt.Tx) error {
|
||||
bucket, err := tx.CreateBucketIfNotExists(bucketPrefix)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user