diff options
Diffstat (limited to 'repository')
-rw-r--r-- | repository/git.go | 8 | ||||
-rw-r--r-- | repository/repo.go | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/repository/git.go b/repository/git.go index d01a8e68..db411792 100644 --- a/repository/git.go +++ b/repository/git.go @@ -366,6 +366,7 @@ func (repo *GitRepo) createClocks() error { return nil } +// LoadClocks read the clocks values from the on-disk repo func (repo *GitRepo) LoadClocks() error { createClock, err := lamport.LoadPersisted(repo.GetPath() + createClockFile) if err != nil { @@ -382,6 +383,7 @@ func (repo *GitRepo) LoadClocks() error { return nil } +// WriteClocks write the clocks values into the repo func (repo *GitRepo) WriteClocks() error { err := repo.createClock.Write() if err != nil { @@ -396,18 +398,24 @@ func (repo *GitRepo) WriteClocks() error { return nil } +// CreateTimeIncrement increment the creation clock and return the new value. func (repo *GitRepo) CreateTimeIncrement() (lamport.Time, error) { return repo.createClock.Increment() } +// EditTimeIncrement increment the edit clock and return the new value. func (repo *GitRepo) EditTimeIncrement() (lamport.Time, error) { return repo.editClock.Increment() } +// CreateWitness witness another create time and increment the corresponding clock +// if needed. func (repo *GitRepo) CreateWitness(time lamport.Time) error { return repo.createClock.Witness(time) } +// EditWitness witness another edition time and increment the corresponding clock +// if needed. func (repo *GitRepo) EditWitness(time lamport.Time) error { return repo.editClock.Witness(time) } diff --git a/repository/repo.go b/repository/repo.go index 053837db..0cddf38a 100644 --- a/repository/repo.go +++ b/repository/repo.go @@ -76,16 +76,24 @@ type Repo interface { type ClockedRepo interface { Repo + // LoadClocks read the clocks values from the on-disk repo LoadClocks() error + // WriteClocks write the clocks values into the repo WriteClocks() error + // CreateTimeIncrement increment the creation clock and return the new value. CreateTimeIncrement() (lamport.Time, error) + // EditTimeIncrement increment the edit clock and return the new value. EditTimeIncrement() (lamport.Time, error) + // CreateWitness witness another create time and increment the corresponding + // clock if needed. CreateWitness(time lamport.Time) error + // EditWitness witness another edition time and increment the corresponding + // clock if needed. EditWitness(time lamport.Time) error } |