Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(811)

Delta Between Two Patch Sets: services/auth_service/common/replication.py

Issue 106310043: Protocol, UI and smoke test for Primary <-> Replica linking process. (Closed) Base URL: https://code.google.com/p/swarming/@master
Left Patch Set: Created 10 years, 9 months ago
Right Patch Set: Created 10 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « services/auth_service/PRESUBMIT.py ('k') | services/auth_service/frontend/handlers.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Copyright 2014 The Swarming Authors. All rights reserved. 1 # Copyright 2014 The Swarming Authors. All rights reserved.
2 # Use of this source code is governed by the Apache v2.0 license that can be 2 # Use of this source code is governed by the Apache v2.0 license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Primary side of Primary <-> Replica protocol.""" 5 """Primary side of Primary <-> Replica protocol."""
6 6
7 from google.appengine.ext import ndb 7 from google.appengine.ext import ndb
8 8
9 from components import datastore_utils 9 from components import datastore_utils
10 10
(...skipping 10 matching lines...) Expand all
21 # How to convert this entity to serializable dict. 21 # How to convert this entity to serializable dict.
22 serializable_properties = { 22 serializable_properties = {
23 'replica_url': datastore_utils.READABLE, 23 'replica_url': datastore_utils.READABLE,
24 'auth_db_rev': datastore_utils.READABLE, 24 'auth_db_rev': datastore_utils.READABLE,
25 'rev_modified_ts': datastore_utils.READABLE, 25 'rev_modified_ts': datastore_utils.READABLE,
26 } 26 }
27 27
28 # URL of a host to push AuthDB updates to, especially useful on dev_appserver. 28 # URL of a host to push AuthDB updates to, especially useful on dev_appserver.
29 replica_url = ndb.StringProperty(indexed=False) 29 replica_url = ndb.StringProperty(indexed=False)
30 # Revision of auth DB replica is synced to. 30 # Revision of auth DB replica is synced to.
31 auth_db_rev = ndb.IntegerProperty(indexed=False) 31 auth_db_rev = ndb.IntegerProperty(default=0, indexed=False)
32 # Time when auth_db_rev was created (by primary clock). 32 # Time when auth_db_rev was created (by primary clock).
33 rev_modified_ts = ndb.DateTimeProperty(indexed=False) 33 rev_modified_ts = ndb.DateTimeProperty(indexed=False)
34 # Secret known to both Primary and Replica.
35 shared_secret = ndb.BlobProperty(indexed=False)
M-A 2014/06/30 01:18:31 Why not use asymmetric encryption?
vadimsh 2014/06/30 22:58:52 Good idea. I initially (~several months ago) wante
36 34
37 35
38 def register_replica(app_id, replica_url, shared_secret): 36 def register_replica(app_id, replica_url):
39 """Create a new AuthReplicaState or reset the state of existing one.""" 37 """Creates a new AuthReplicaState or resets the state of existing one."""
M-A 2014/06/30 01:18:31 Creates resets
vadimsh 2014/06/30 22:58:52 Done.
40 ent = AuthReplicaState( 38 ent = AuthReplicaState(
41 id=app_id, 39 id=app_id,
42 parent=REPLICAS_ROOT_KEY, 40 parent=REPLICAS_ROOT_KEY,
43 replica_url=replica_url, 41 replica_url=replica_url)
44 auth_db_rev=0,
M-A 2014/06/30 01:18:31 Why not use default=0?
vadimsh 2014/06/30 22:58:52 Done.
45 rev_modified_ts=None,
M-A 2014/06/30 01:18:31 Not really necessary?
vadimsh 2014/06/30 22:58:52 Done.
46 shared_secret=shared_secret)
47 ent.put() 42 ent.put()
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b