Update metadata interfaces for containers and leases

Add more thorough dirty checking across all types which
may be deleted and hold references.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2019-09-19 16:06:13 -07:00
parent d4802a64f9
commit 0b224ac7d6
15 changed files with 539 additions and 606 deletions

View File

@@ -166,17 +166,13 @@ func TestIngestLeased(t *testing.T) {
}
func createLease(ctx context.Context, db *DB, name string) (context.Context, func() error, error) {
if err := db.Update(func(tx *bolt.Tx) error {
_, err := NewLeaseManager(tx).Create(ctx, leases.WithID(name))
return err
}); err != nil {
lm := NewLeaseManager(db)
if _, err := lm.Create(ctx, leases.WithID(name)); err != nil {
return nil, nil, err
}
return leases.WithLease(ctx, name), func() error {
return db.Update(func(tx *bolt.Tx) error {
return NewLeaseManager(tx).Delete(ctx, leases.Lease{
ID: name,
})
return lm.Delete(ctx, leases.Lease{
ID: name,
})
}, nil
}