| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Implementation of CloudBucket using Google Cloud Storage as the backend.""" | 5 """Implementation of CloudBucket using Google Cloud Storage as the backend.""" |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 import cloudstorage | 9 import cloudstorage |
| 10 | 10 |
| 11 from ..common import cloud_bucket | 11 from common import cloud_bucket |
| 12 | 12 |
| 13 | 13 |
| 14 class GoogleCloudStorageBucket(cloud_bucket.BaseCloudBucket): | 14 class GoogleCloudStorageBucket(cloud_bucket.BaseCloudBucket): |
| 15 """Subclass of cloud_bucket.CloudBucket with actual GS commands.""" | 15 """Subclass of cloud_bucket.CloudBucket with actual GS commands.""" |
| 16 | 16 |
| 17 def __init__(self, bucket): | 17 def __init__(self, bucket): |
| 18 """Initializes the bucket. | 18 """Initializes the bucket. |
| 19 | 19 |
| 20 Args: | 20 Args: |
| 21 bucket: the name of the bucket to connect to. | 21 bucket: the name of the bucket to connect to. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 return True | 63 return True |
| 64 | 64 |
| 65 # override | 65 # override |
| 66 def GetImageURL(self, path): | 66 def GetImageURL(self, path): |
| 67 return '/image?file_path=%s' % path | 67 return '/image?file_path=%s' % path |
| 68 | 68 |
| 69 # override | 69 # override |
| 70 def GetAllPaths(self, prefix): | 70 def GetAllPaths(self, prefix): |
| 71 return (f.filename[len(self.bucket) + 1:] for f in | 71 return (f.filename[len(self.bucket) + 1:] for f in |
| 72 cloudstorage.listbucket(self.bucket, prefix=prefix)) | 72 cloudstorage.listbucket(self.bucket, prefix=prefix)) |
| OLD | NEW |