lib/db: Rework flush hooks (#6838)

This commit is contained in:
Audrius Butkevicius
2020-07-19 08:55:27 +02:00
committed by GitHub
parent 851ee51c1b
commit 55147f5901
8 changed files with 62 additions and 60 deletions
+4 -2
View File
@@ -15,6 +15,8 @@ import (
"github.com/syncthing/syncthing/lib/locations"
)
type CommitHook func(WriteTransaction) error
// The Reader interface specifies the read-only operations available on the
// main database and on read-only transactions (snapshots). Note that when
// called directly on the database handle these operations may take implicit
@@ -61,7 +63,7 @@ type ReadTransaction interface {
type WriteTransaction interface {
ReadTransaction
Writer
Checkpoint(...func() error) error
Checkpoint() error
Commit() error
}
@@ -108,7 +110,7 @@ type Backend interface {
Reader
Writer
NewReadTransaction() (ReadTransaction, error)
NewWriteTransaction() (WriteTransaction, error)
NewWriteTransaction(hooks ...CommitHook) (WriteTransaction, error)
Close() error
Compact() error
}