LoadPersistedClock load a persisted Lamport clock from a file
(root billy.Filesystem, filePath string)
| 36 | |
| 37 | // LoadPersistedClock load a persisted Lamport clock from a file |
| 38 | func LoadPersistedClock(root billy.Filesystem, filePath string) (*PersistedClock, error) { |
| 39 | clock := &PersistedClock{ |
| 40 | root: root, |
| 41 | filePath: filePath, |
| 42 | } |
| 43 | |
| 44 | err := clock.read() |
| 45 | if err != nil { |
| 46 | return nil, err |
| 47 | } |
| 48 | |
| 49 | return clock, nil |
| 50 | } |
| 51 | |
| 52 | // Increment is used to return the value of the lamport clock and increment it afterwards |
| 53 | func (pc *PersistedClock) Increment() (Time, error) { |