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 // Package txnBuf contains a transaction buffer filter for the datastore | 5 // Package txnBuf contains a transaction buffer filter for the datastore |
6 // service. | 6 // service. |
7 // | 7 // |
8 // By default, datastore transactions take a snapshot of the entity group as | 8 // By default, datastore transactions take a snapshot of the entity group as |
9 // soon as you Get or Put into it. All subsequent Get (and query) operations | 9 // soon as you Get or Put into it. All subsequent Get (and query) operations |
10 // reflect the state of the ORIGINAL transaction snapshot, regardless of any | 10 // reflect the state of the ORIGINAL transaction snapshot, regardless of any |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // - Metadata entities (e.g. `__entity_group__`) will reflect their values as | 50 // - Metadata entities (e.g. `__entity_group__`) will reflect their values as |
51 // they were at the beginning of the transaction, and will not increment | 51 // they were at the beginning of the transaction, and will not increment |
52 // as you write inside of the transaction. | 52 // as you write inside of the transaction. |
53 // | 53 // |
54 // - Query cursors are not supported. Since the cursor format for the | 54 // - Query cursors are not supported. Since the cursor format for the |
55 // in-memory datastore implementation isn't compatible with the production | 55 // in-memory datastore implementation isn't compatible with the production |
56 // cursors, it would be pretty tricky to make it so that cursors were | 56 // cursors, it would be pretty tricky to make it so that cursors were |
57 // viable outside the transaction as well as inside of it while also having | 57 // viable outside the transaction as well as inside of it while also having |
58 // it accurately reflect the 'merged' query results. | 58 // it accurately reflect the 'merged' query results. |
59 // | 59 // |
60 // - No parallel access to datastore while in a transaction; all nested | 60 // - No parallel access* to datastore while in a transaction; all nested |
61 // transactions are serialized. This is done for simplicity and correctness. | 61 // operations are serialized. This is done for simplicity and correctness. |
| 62 // |
| 63 // * The exception is that callbacks inside of |
| 64 // a Run/GetMulti/DeleteMulti/PutMulti query MAY read/write the current |
| 65 // transaction. Modifications to the datastore during query executions will |
| 66 // not affect the query results (e.g. the query has snapshot consistency |
| 67 // from the moment that it begins iteration). Note, however, that datastore |
| 68 // operations within the callback are still synchronized. This behavior is |
| 69 // so that the user is not forced to buffer all of the query results before |
| 70 // doing work with them, but can treat the query like a stream of events, |
| 71 // if they so choose. |
62 // | 72 // |
63 // - The changing of namespace inside of a transaction is undefined... This is | 73 // - The changing of namespace inside of a transaction is undefined... This is |
64 // just generally a terrible idea anyway, but I thought it was worth | 74 // just generally a terrible idea anyway, but I thought it was worth |
65 // mentioning. | 75 // mentioning. |
66 package txnBuf | 76 package txnBuf |
OLD | NEW |