veyron/services/store/memstore/watch: Better handling of unknown resume markers.

Watch stamps every change with a resume marker corresponding to the
transaction timestamp.
Previously, if the request contained a resume marker R, Watch returned
all changes with resume marker > R. This algorithm has two problems:
 1) Watch cannot be restarted in the middle of a transaction. If the
    client processes some, but not all, of transaction T, and starts
    Watch with the resume marker R corresponding to T, it will receive
    only changes with resume marker R+1, corresponding to T+1.
 2) Watch does not flag unknown resume markers. Let's say a store has
    changes with resume markers R, R+1 and R+2. A client receives R,
    and the connection breaks. The store then compacts and forgets R and
    R+1. When the client starts Watch with R, it will receive only R+2,
    and will not realize it missed R+1.
After this change, Watch returns all changes with resume marker >= R,
if it remembers R. Otherwise, it returns ErrUnknownResumeMarker.

There is, however, a minor bug in this implementation. Watch will not
immediately return ErrUnknownResumeMarker if the most recent timestamp
in the log is < R. If a change with resume marker R is eventually
written to the log, Watch will not return an error. However, this is the
same as a client accidentally starting Watch with an incorrect, existing
resume marker. Otherwise, Watch will return ErrUnkownResumeMarker when
the most recent timestamp in the log becomes > R.

Change-Id: I61fac61c7f63d784e5a5401aef6b712ea2c5f4eb
2 files changed
tree: 634da3178f7709a3e45792fbac77e200a2bab01b
  1. examples/
  2. lib/
  3. runtimes/
  4. security/
  5. services/
  6. tools/