[autotest] Endpoints for syncing jobs and hqes back to master

The status of jobs that were completed on a shard should be visible
in the master AFE, so a human can easily see which jobs have been run in one
central place.

This adds the functionality to the AFE to retrieve newer versions of
jobs and hqes from shards.

This is a newer version of CL:213901 which was reverted because of
http://crbug.com/418022.

BUG=418022
DEPLOY=apache, afe
TEST=Ran Suites

Change-Id: I3c9a35c78585a43d193874decbb7b16216b2c69a
Reviewed-on: https://chromium-review.googlesource.com/220141
Reviewed-by: Fang Deng <fdeng@chromium.org>
Tested-by: Jakob Jülich <jakobjuelich@chromium.org>
Commit-Queue: Jakob Jülich <jakobjuelich@chromium.org>
diff --git a/frontend/afe/model_logic.py b/frontend/afe/model_logic.py
index 6329bd0..c77c80a 100644
--- a/frontend/afe/model_logic.py
+++ b/frontend/afe/model_logic.py
@@ -1117,6 +1117,18 @@
         return instance
 
 
+    def sanity_check_update_from_shard(self, shard, updated_serialized,
+                                       *args, **kwargs):
+        """Check if an update sent from a shard is legitimate.
+
+        @raises error.UnallowedRecordsSentToMaster if an update is not
+                legitimate.
+        """
+        raise NotImplementedError(
+            'sanity_check_update_from_shard must be implemented by subclass %s '
+            'for type %s' % type(self))
+
+
     def update_from_serialized(self, serialized):
         """Updates local fields of an existing object from a serialized form.