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)
| 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. |
| 304 | func (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. |
| 318 | func (watcher *SyncWatcher) storeRevision(path string, revision int64) error { |
no test coverage detected