| OLD | NEW |
| 1 # Copyright 2014 The LUCI Authors. All rights reserved. | 1 # Copyright 2014 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """This module defines Isolate Server frontend url handlers.""" | 5 """This module defines Isolate Server frontend url handlers.""" |
| 6 | 6 |
| 7 import binascii | 7 import binascii |
| 8 import datetime | 8 import datetime |
| 9 import hashlib | 9 import hashlib |
| 10 import logging | 10 import logging |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 DEFAULT_LINK_EXPIRATION = datetime.timedelta(hours=4) | 119 DEFAULT_LINK_EXPIRATION = datetime.timedelta(hours=4) |
| 120 | 120 |
| 121 | 121 |
| 122 # messages for generating and validating upload tickets | 122 # messages for generating and validating upload tickets |
| 123 UPLOAD_MESSAGES = ['datastore', 'gs'] | 123 UPLOAD_MESSAGES = ['datastore', 'gs'] |
| 124 | 124 |
| 125 | 125 |
| 126 class TokenSigner(auth.TokenKind): | 126 class TokenSigner(auth.TokenKind): |
| 127 """Used to create upload tickets.""" | 127 """Used to create upload tickets.""" |
| 128 expiration_sec = DEFAULT_LINK_EXPIRATION.total_seconds() | 128 expiration_sec = DEFAULT_LINK_EXPIRATION.total_seconds() |
| 129 secret_key = auth.SecretKey('isolate_upload_token', scope='local') | 129 secret_key = auth.SecretKey('isolate_upload_token') |
| 130 | 130 |
| 131 | 131 |
| 132 @ndb.transactional | 132 @ndb.transactional |
| 133 def store_and_enqueue_verify_task(entry, task_queue_host): | 133 def store_and_enqueue_verify_task(entry, task_queue_host): |
| 134 entry.put() | 134 entry.put() |
| 135 taskqueue.add( | 135 taskqueue.add( |
| 136 url='/internal/taskqueue/verify/%s' % entry.key.id(), | 136 url='/internal/taskqueue/verify/%s' % entry.key.id(), |
| 137 params={'req': os.environ['REQUEST_LOG_ID']}, | 137 params={'req': os.environ['REQUEST_LOG_ID']}, |
| 138 queue_name='verify', | 138 queue_name='verify', |
| 139 headers={'Host': task_queue_host}, | 139 headers={'Host': task_queue_host}, |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 url = '/internal/taskqueue/tag/%s/%s' % ( | 541 url = '/internal/taskqueue/tag/%s/%s' % ( |
| 542 collection.namespace.namespace, | 542 collection.namespace.namespace, |
| 543 utils.datetime_to_timestamp(utils.utcnow())) | 543 utils.datetime_to_timestamp(utils.utcnow())) |
| 544 payload = ''.join( | 544 payload = ''.join( |
| 545 binascii.unhexlify(digest.digest) for digest in collection.items) | 545 binascii.unhexlify(digest.digest) for digest in collection.items) |
| 546 return utils.enqueue_task(url, 'tag', payload=payload) | 546 return utils.enqueue_task(url, 'tag', payload=payload) |
| 547 | 547 |
| 548 | 548 |
| 549 def get_routes(): | 549 def get_routes(): |
| 550 return endpoints_webapp2.api_routes(IsolateService) | 550 return endpoints_webapp2.api_routes(IsolateService) |
| OLD | NEW |