MCPcopy Create free account
hub / github.com/cloudwan/gohan / fetchStoredRevision

Method fetchStoredRevision

server/sync_watcher.go:304–315  ·  view source on GitHub ↗

fetchStoredRevision returns the revision number stored in the sync backend for a path. When it's a new in the backend, returns sync.RevisionCurrent.

(path string)

Source from the content-addressed store, hash-verified

302// fetchStoredRevision returns the revision number stored in the sync backend for a path.
303// When it's a new in the backend, returns sync.RevisionCurrent.
304func (watcher *SyncWatcher) fetchStoredRevision(path string) int64 { // TODO error?
305 fromRevision := int64(gohan_sync.RevisionCurrent)
306 lastSeen, err := watcher.sync.Fetch(SyncWatchRevisionPrefix + path)
307 if err == nil {
308 inStore, err := strconv.ParseInt(lastSeen.Value, 10, 64)
309 if err == nil {
310 log.Info("Using last seen revision `%d` for watching path `%s`", inStore, path)
311 fromRevision = inStore
312 }
313 }
314 return fromRevision
315}
316
317// storeRevision puts a reivision number for a path to the sync backend.
318func (watcher *SyncWatcher) storeRevision(path string, revision int64) error {

Callers 1

processSyncWatchMethod · 0.95

Calls 2

FetchMethod · 0.65
InfoMethod · 0.65

Tested by

no test coverage detected