OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package rawdatastore |
| 6 |
| 7 // ByteString is a short byte slice (up to 1500 bytes) that can be indexed. |
| 8 type ByteString []byte |
| 9 |
| 10 // GeoPoint represents a location as latitude/longitude in degrees. |
| 11 // |
| 12 // You probably shouldn't use these, but their inclusion here is so that the |
| 13 // RawDatastore can interact (and round-trip) correctly with other datastore API |
| 14 // implementations. |
| 15 type GeoPoint struct { |
| 16 Lat, Lng float64 |
| 17 } |
| 18 |
| 19 // Valid returns whether a GeoPoint is within [-90, 90] latitude and [-180, |
| 20 // 180] longitude. |
| 21 func (g GeoPoint) Valid() bool { |
| 22 return -90 <= g.Lat && g.Lat <= 90 && -180 <= g.Lng && g.Lng <= 180 |
| 23 } |
| 24 |
| 25 // TransactionOptions are the options for running a transaction. |
| 26 type TransactionOptions struct { |
| 27 // XG is whether the transaction can cross multiple entity groups. In |
| 28 // comparison, a single group transaction is one where all datastore key
s |
| 29 // used have the same root key. Note that cross group transactions do no
t |
| 30 // have the same behavior as single group transactions. In particular, i
t |
| 31 // is much more likely to see partially applied transactions in differen
t |
| 32 // entity groups, in global queries. |
| 33 // It is valid to set XG to true even if the transaction is within a |
| 34 // single entity group. |
| 35 XG bool |
| 36 // Attempts controls the number of retries to perform when commits fail |
| 37 // due to a conflicting transaction. If omitted, it defaults to 3. |
| 38 Attempts int |
| 39 } |
OLD | NEW |