| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Provides a model to support versioned entities in datastore. | 5 """Provides a model to support versioned entities in datastore. |
| 6 | 6 |
| 7 Idea: use a root model entity to keep track of the most recent version of a | 7 Idea: use a root model entity to keep track of the most recent version of a |
| 8 versioned entity, and make the versioned entities and the root model entity in | 8 versioned entity, and make the versioned entities and the root model entity in |
| 9 the same entity group so that they could be read and written in a transaction. | 9 the same entity group so that they could be read and written in a transaction. |
| 10 """ | 10 """ |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 @classmethod | 156 @classmethod |
| 157 def _get_kind(cls): | 157 def _get_kind(cls): |
| 158 return root_model_name | 158 return root_model_name |
| 159 | 159 |
| 160 return _RootModel | 160 return _RootModel |
| 161 | 161 |
| 162 @classmethod | 162 @classmethod |
| 163 def _GetRootKey(cls, key=None): | 163 def _GetRootKey(cls, key=None): |
| 164 return ndb.Key(cls._GetRootModel(), key if key is not None else 1) | 164 return ndb.Key(cls._GetRootModel(), key if key is not None else 1) |
| OLD | NEW |