The staticcheck.io complained that in some places in the
assert tests values are assigned but not used. This commit
fixes this by checking the values. Alternatives we could
of course just use `_, err := ...` instead of `a, err := ...`
but checking seems slightly more sensible to me.
if current system time is unreliable have a mode where Database checks
for key expiry just based on assuming that current time is >= known
earliest time
this is set up via Database.SetEarliestTime
internally a new predicate AccountKey.isKeyValidAbout(earliest,
latest) is used to support this
FindSequence finds a sequence-forming assertion based the given
headers. Provided headers must contain a prefix of the primary key
for the assertion type except for the sequence header.
Th assertion is the first in the sequence under the prefix with
sequential number > after.
If after is -1 it returns instead the assertion with the largest
sequential number.
This converts the singleton asserts.ErrNotFound to a richer asserts.NotFoundError struct carrying Type and optionally PrimaryKey, similar to store.AssertionNotFoundError which then gets folded with this.
This means code doesn't have to worry anymore which is which or to convert between the two. And when possible there is more information around. Though Backstores can continue to return minimal information (Type but not Headers in the new error).
A helper asserts.IsNotFound is also added to cover the simple old ==/!= asserts.ErrNotFound needs.
This also fixes/adjust some error handling to usually not repeat the richer information twice.