wal: add function to return current changes revision

This commit is contained in:
Simone Gotti 2019-03-28 16:01:33 +01:00
parent 975bc810b3
commit 3e9fcf9d7b
1 changed files with 9 additions and 0 deletions

View File

@ -155,6 +155,15 @@ type ChangeGroupsUpdateToken struct {
type changeGroupsRevisions map[string]int64
func (w *WalManager) ChangesCurrentRevision() (int64, error) {
w.changes.Lock()
defer w.changes.Unlock()
if !w.changes.initialized {
return 0, errors.Errorf("wal changes not ready")
}
return w.changes.revision, nil
}
func (w *WalManager) GetChangeGroupsUpdateToken(cgNames []string) (*ChangeGroupsUpdateToken, error) {
w.changes.Lock()
defer w.changes.Unlock()