channeldb: slightly refactor the [Fetch|Put]Meta methods

This commit performs a slight refactoring of the internals (and API) of
the [Fetch|Put]Meta methods. The changes are rather minor and simply
eliminate the conditional branching structure with usage of an internal
function. This new form is much easier to follow.
This commit is contained in:
Olaoluwa Osuntokun committed 2016-11-27 18:44:23 -08:00
1 parent 5b2f9a5b69
commit 7454b7df95
3 files changed
+41 -47

No files matched your search

+4 -2
View File
@@ -30,7 +30,7 @@ func TestVersionFetchPut(t *testing.T) {
var newVersion uint32 = getLatestDBVersion(dbVersions) + 1
meta.DbVersionNumber = newVersion
if err := db.PutMeta(meta, nil); err != nil {
if err := db.PutMeta(meta); err != nil {
t.Fatalf("update of meta failed %v", err)
}
@@ -129,7 +129,9 @@ func applyMigration(t *testing.T, beforeMigration, afterMigration func(d *DB),
// Create test meta info with zero database version and put it on disk.
// Than creating the version list pretending that new version was added.
meta := &Meta{DbVersionNumber: 0}
cdb.PutMeta(meta, nil)
if err := cdb.PutMeta(meta); err != nil {
t.Fatal("unable to store meta data: %v", err)
}
versions := []version{
{