MCPcopy Create free account
hub / github.com/git-bug/git-bug / NewPersistedClock

Function NewPersistedClock

util/lamport/persisted_clock.go:22–35  ·  view source on GitHub ↗

NewPersistedClock create a new persisted Lamport clock

(root billy.Filesystem, filePath string)

Source from the content-addressed store, hash-verified

20
21// NewPersistedClock create a new persisted Lamport clock
22func NewPersistedClock(root billy.Filesystem, filePath string) (*PersistedClock, error) {
23 clock := &PersistedClock{
24 MemClock: NewMemClock(),
25 root: root,
26 filePath: filePath,
27 }
28
29 err := clock.Write()
30 if err != nil {
31 return nil, err
32 }
33
34 return clock, nil
35}
36
37// LoadPersistedClock load a persisted Lamport clock from a file
38func LoadPersistedClock(root billy.Filesystem, filePath string) (*PersistedClock, error) {

Callers 2

GetOrCreateClockMethod · 0.92
TestPersistedClockFunction · 0.85

Calls 2

WriteMethod · 0.95
NewMemClockFunction · 0.85

Tested by 1

TestPersistedClockFunction · 0.68