Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: third_party/gsutil/boto/boto/dynamodb/batch.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
2 # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
3 #
4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including
7 # without limitation the rights to use, copy, modify, merge, publish, dis-
8 # tribute, sublicense, and/or sell copies of the Software, and to permit
9 # persons to whom the Software is furnished to do so, subject to the fol-
10 # lowing conditions:
11 #
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
17 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
18 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 # IN THE SOFTWARE.
22 #
23
24
25 class Batch(object):
26 """
27 :ivar table: The Table object from which the item is retrieved.
28
29 :ivar keys: A list of scalar or tuple values. Each element in the
30 list represents one Item to retrieve. If the schema for the
31 table has both a HashKey and a RangeKey, each element in the
32 list should be a tuple consisting of (hash_key, range_key). If
33 the schema for the table contains only a HashKey, each element
34 in the list should be a scalar value of the appropriate type
35 for the table schema.
36
37 :ivar attributes_to_get: A list of attribute names.
38 If supplied, only the specified attribute names will
39 be returned. Otherwise, all attributes will be returned.
40 """
41
42 def __init__(self, table, keys, attributes_to_get=None):
43 self.table = table
44 self.keys = keys
45 self.attributes_to_get = attributes_to_get
46
47
48 class BatchList(list):
49 """
50 A subclass of a list object that contains a collection of
51 :class:`boto.dynamodb.batch.Batch` objects.
52 """
53
54 def __init__(self, layer2):
55 list.__init__(self)
56 self.layer2 = layer2
57
58 def add_batch(self, table, keys, attributes_to_get=None):
59 """
60 Add a Batch to this BatchList.
61
62 :type table: :class:`boto.dynamodb.table.Table`
63 :param table: The Table object in which the items are contained.
64
65 :type keys: list
66 :param keys: A list of scalar or tuple values. Each element in the
67 list represents one Item to retrieve. If the schema for the
68 table has both a HashKey and a RangeKey, each element in the
69 list should be a tuple consisting of (hash_key, range_key). If
70 the schema for the table contains only a HashKey, each element
71 in the list should be a scalar value of the appropriate type
72 for the table schema.
73
74 :type attributes_to_get: list
75 :param attributes_to_get: A list of attribute names.
76 If supplied, only the specified attribute names will
77 be returned. Otherwise, all attributes will be returned.
78 """
79 self.append(Batch(table, keys, attributes_to_get))
80
81 def submit(self):
82 return self.layer2.batch_get_item(self)
OLDNEW
« no previous file with comments | « third_party/gsutil/boto/boto/dynamodb/__init__.py ('k') | third_party/gsutil/boto/boto/dynamodb/condition.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698