code: func (op *Operation) Advance(c context.Context, cb func(context.Context, *Operation) error) (*Operation, error) {
  	fresh := &Operation{ID: op.ID}
  	err := datastore.RunInTransaction(c, func(c context.Context) error {
  		if err := datastore.Get(c, fresh); err != nil || fresh.Status != op.Status {
  			return err
  		}
  		if err := cb(c, fresh); err != nil {
  			return err
  		}
  		fresh.UpdatedTS = clock.Now(c).UTC()
  		return datastore.Put(c, fresh)
  	}, nil)
  	if err != nil {
  		return nil, errors.Annotate(err, "failed to update the upload operation").
  			Tag(transient.Tag).Err()
  	}
  	return fresh, nil
  }
docs: // Advance transactionally updates the entity (by calling the callback)
  // if its Status in the datastore is still same as op.Status.
  //
  // If the entity in the datastore has different Status, silently skips calling
  // the callback. It means the entity has been updated concurrently. This works
  // because all Operation mutations actually switch statuses and the Operation
  // state machine can "roll" only in one direction.
  //
  // Returns the most recent state of the operation (whether it was mutated just
  // now by the callback or not). 'op' itself is kept intact.
  //
  // Returns only transient errors. All callback errors are tagged as transient
  // as well.