Create metadata db object#1582
Conversation
f482e21 to
a6c528b
Compare
Codecov Report
@@ Coverage Diff @@
## master #1582 +/- ##
==========================================
+ Coverage 46.29% 46.33% +0.03%
==========================================
Files 24 26 +2
Lines 3378 3535 +157
==========================================
+ Hits 1564 1638 +74
- Misses 1456 1519 +63
- Partials 358 378 +20
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
for lint, just return here
There was a problem hiding this comment.
could this data get stale or out of sync?
There was a problem hiding this comment.
Right now no, but the model is wrong and I am fixing it. Afterwards services will only need to load the metadata plugin and will get the snapshotter and content store from that single instance. That will prevent the dynamic registration model that it is using today, even though the registration only occurs during initialization.
|
LGTM |
1 similar comment
|
LGTM |
|
Before I update this, I am thinking we should add some migration and tighter versioning logic to the database. It would not be too difficult to add. In this case it is not extremely important but it could be useful and would be nice to have in before 1.0. |
Signed-off-by: Derek McGowan <[email protected]>
Adds back links from parent to children in order to prevent deletion of a referenced snapshot in a namespace. Avoid removing snapshot during metadata delete to prevent shared namespaces from being mistakenly deleted. Signed-off-by: Derek McGowan <[email protected]>
Update database object to hold reference to the data stores. Signed-off-by: Derek McGowan <[email protected]>
Updates metadata plugin to require content and snapshotter plugins be loaded and initializes with those plugins, keeping the metadata database structure static after initialization. Service plugins now only require metadata plugin access snapshotter or content stores through metadata, which was already required behavior of the services. Signed-off-by: Derek McGowan <[email protected]>
Signed-off-by: Derek McGowan <[email protected]>
4a2c131 to
7f657ce
Compare
| migrate func(*bolt.Tx) error | ||
| } | ||
|
|
||
| var migrations = []migration{ |
There was a problem hiding this comment.
Let's document the addition of migrations.
| version = 0 | ||
| ) | ||
|
|
||
| i := len(migrations) |
There was a problem hiding this comment.
Could you put the migrations components into a separate function/method?
|
LGTM on the migrations component. |
Creates a metadata database object for abstracting the database file from users of the metadata store. This new database object provides the same transaction functions which bolt db has. This is needed in the future to provide locking around the transactions and provides a shared object to target for metadata garbage collection.
Additionally fixes snapshot remove relying on backend deletion in order to check for child relationships. Added the child relationships to the metadata store. Immediate backend deletion should not occur since the metadata store must not prevent sharing snapshots across namespaces. Note we currently don't have an interface exposed to shared snapshots, but it is a planned feature and should not be made impossible by the database.