channeldb: added channeldb versioning

In this commit the upgrade mechanism for database was added which makes he current schema rigid and upgradeable. Additional bucket 'metaBucket' was added which stores
    key that house meta-data related to the current/version state of the database. 'createChannelDB' was modified to create this new bucket+key during initializing. Also
    backup logic was added which makes a complete copy of the current database during migration process and restore the previous version of database if migration failed.
This commit is contained in:
Andrey Samokhvalov
2016-11-22 23:50:27 +03:00
committed by Olaoluwa Osuntokun
parent 2bf5794645
commit c53ea091dd
5 changed files with 552 additions and 8 deletions

View File

@@ -14,4 +14,5 @@ var (
ErrDuplicateInvoice = fmt.Errorf("invoice with payment hash already exists")
ErrNodeNotFound = fmt.Errorf("link node with target identity not found")
ErrMetaNotFound = fmt.Errorf("unable to locate meta information")
)