Skip to content

Commit adbaf82

Browse files
author
Michael Farb
committed
implemented and deployed GCS
- Closes SafeSlingerProject#38.
1 parent 79e49b2 commit adbaf82

File tree

12 files changed

+2786
-27
lines changed

12 files changed

+2786
-27
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ python:
44
- "2.7"
55

66
before_script:
7-
- wget https://commondatastorage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.21.zip -nv
8-
- unzip -q google_appengine_1.9.21.zip
7+
- wget https://commondatastorage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.26.zip -nv
8+
- unzip -q google_appengine_1.9.26.zip
99

1010
script: nosetests

safeslinger-messenger/python/cleanup.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@
2323
import datetime
2424
import logging
2525

26-
from google.appengine.ext import blobstore, db, webapp
26+
from google.appengine.ext import db
27+
from google.appengine.ext import webapp
2728
from google.appengine.ext.webapp import util
2829

2930
import c2dmAuthToken
31+
import cloudstorage as gcs
3032
import filestorage
3133
import registration
3234

@@ -53,10 +55,10 @@ def get(self):
5355
for f in fquery:
5456
# remove downloaded after TIMEOUT_DOWN, or failed pushes, and the rest after TIMEOUT_PEND
5557
if (f.downloaded) or (not f.push_accepted) or (f.inserted < pendlastDate):
56-
blob_key = f.blobkey
58+
filename = f.blobkey
5759
# delete blobstore item if exists
58-
if blob_key:
59-
blobstore.delete(f.blobkey)
60+
if filename:
61+
gcs.delete(filename)
6062
# delete datastore item
6163
files.append(f)
6264

@@ -106,6 +108,7 @@ def get(self):
106108
if tokens.__len__() > 0:
107109
logging.info('cleanup: old tokens=%i' % (tokens.__len__()))
108110

111+
109112
def main():
110113
application = webapp.WSGIApplication([('/cron/cleanup', CleanUp)],
111114
debug=True)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2014 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing,
10+
# software distributed under the License is distributed on an
11+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
12+
# either express or implied. See the License for the specific
13+
# language governing permissions and limitations under the License.
14+
15+
"""Client Library for Google Cloud Storage."""
16+
17+
18+
19+
20+
from .api_utils import RetryParams
21+
from .api_utils import set_default_retry_params
22+
from cloudstorage_api import *
23+
from .common import CSFileStat
24+
from .common import GCSFileStat
25+
from .common import validate_bucket_name
26+
from .common import validate_bucket_path
27+
from .common import validate_file_path
28+
from errors import *
29+
from storage_api import *

0 commit comments

Comments
 (0)