def __init__(self, collection='entities'): AMongoCollection.__init__(self, collection=collection, primary_key='entity_id', overflow=True) AEntityDB.__init__(self) fast_resolve_fields = ('sources.amazon_id', 'sources.spotify_id', 'sources.rdio_id', 'sources.opentable_id', 'sources.tmdb_id', 'sources.factual_id', 'sources.instagram_id', 'sources.singleplatform_id', 'sources.foursquare_id', 'sources.fandango_id', 'sources.googleplaces_id', 'sources.itunes_id', 'sources.netflix_id', 'sources.thetvdb_id', 'sources.nytimes_id', 'sources.umdmusic_id', 'sources.tombstone_id') for field in fast_resolve_fields: self._collection.ensure_index(field) self._collection.ensure_index([ ('search_tokens', pymongo.ASCENDING), ('sources.user_generated_id', pymongo.ASCENDING), ('sources.tombstone_id', pymongo.ASCENDING), ]) self._collection.ensure_index('search_tokens') self._collection.ensure_index('titlel') self._collection.ensure_index('albums.title') self._collection.ensure_index('artists.title') self._collection.ensure_index('authors.title') self._collection.ensure_index('tracks.title') self._collection.ensure_index([('_id', pymongo.ASCENDING), ('sources.user_generated_id', pymongo.ASCENDING)]) self._cache = globalMemcache()
def __init__(self): AMongoCollection.__init__(self, collection='accesstokens') AAuthAccessTokenDB.__init__(self) self._cache = globalMemcache() self._collection.ensure_index([('user_id', pymongo.ASCENDING)])
def __init__(self): AMongoCollection.__init__(self, collection='comments', primary_key='comment_id', obj=Comment, overflow=True) ACommentDB.__init__(self) self._collection.ensure_index('user.user_id') self._collection.ensure_index('timestamp.created') self._collection.ensure_index([('stamp_id', pymongo.ASCENDING)]) self._collection.ensure_index([('_id', pymongo.ASCENDING), ('timestamp.created',pymongo.DESCENDING)]) self._cache = globalMemcache()
def __init__(self, api): AMongoCollection.__init__(self, collection='users', primary_key='user_id', obj=User, overflow=True) AUserDB.__init__(self) self.api = api self._collection.ensure_index('phone') self._collection.ensure_index('linked.twitter.linked_user_id') self._collection.ensure_index('linked.facebook.linked_user_id') self._collection.ensure_index([('screen_name_lower', pymongo.ASCENDING), ('_id', pymongo.ASCENDING)]) self._collection.ensure_index([('name_lower', pymongo.ASCENDING), ('_id', pymongo.ASCENDING)]) self._cache = globalMemcache()
def __init__(self): AMongoCollection.__init__(self, 'users', primary_key='user_id', obj=Account, overflow=True) AAccountDB.__init__(self) ### TEMP: For now, verify that no duplicates can occur via index self._collection.ensure_index('screen_name_lower', unique=True) self._collection.ensure_index('email', unique=True) self._collection.ensure_index('name_lower') self._collection.ensure_index([('linked.facebook.linked_user_id', pymongo.ASCENDING), ('_id', pymongo.ASCENDING)]) self._collection.ensure_index([('linked.twitter.linked_user_id', pymongo.ASCENDING), ('_id', pymongo.ASCENDING)]) self._collection.ensure_index('linked.netflix.linked_user_id') self._cache = globalMemcache()
def __init__(self): AMongoCollection.__init__(self, collection='entitystats', primary_key='entity_id', obj=EntityStats) self._collection.ensure_index([ ('types', pymongo.ASCENDING), ('score', pymongo.DESCENDING), ]) self._collection.ensure_index([ ('types', pymongo.ASCENDING), ('lat', pymongo.ASCENDING), ('lng', pymongo.ASCENDING), ('score', pymongo.DESCENDING), ]) self._cache = globalMemcache()
def __init__(self): AMongoCollection.__init__(self, collection="userlikes") self._cache = globalMemcache()
def __init__(self): AMongoCollection.__init__(self, collection='stampstats', primary_key='stamp_id', obj=StampStats) self._collection.ensure_index([ ('entity_id', pymongo.ASCENDING), ('last_stamped', pymongo.ASCENDING), ('score', pymongo.DESCENDING) ]) self._collection.ensure_index([ ('last_stamped', pymongo.ASCENDING), ('score', pymongo.DESCENDING) ]) self._collection.ensure_index([ ('entity_id', pymongo.ASCENDING), ('score', pymongo.DESCENDING) ]) self._cache = globalMemcache()
def __init__(self): self._prod = IS_PROD self._ec2 = utils.is_ec2() self.api = globalMongoStampedAPI() self._cache = globalMemcache()
def __init__(self, collectionName, blockSize=50, blockBufferSize=20): self._cache = globalMemcache() self._collectionName = collectionName self._blockSize = blockSize self._blockBufferSize = blockBufferSize
] if not IS_PROD: VALID_ORIGINS.extend([ 'http://localhost:19000', 'http://localhost:18000', 'http://localhost:8000', ]) t1 = time.time() # TODO (travis): use single global stamped API instance # e.g., there are MongoStampedAPIs instantiated throughout the codebase => refactor stampedAPI = globalMongoStampedAPI() stampedAuth = MongoStampedAuth() cache = globalMemcache() t2 = time.time() duration = (t2 - t1) * 1.0 logs.info("INIT: %s sec" % duration) if duration > 2: logs.warning("LONG INIT: %s sec" % duration) defaultExceptions = [ (StampedDocumentNotFoundError, 404, 'not_found', 'There was a problem retrieving the requested data'), (StampedAuthError, 401, 'invalid_credentials', 'There was an error during authentication'), (StampedInputError, 400, 'invalid_request', 'An error occurred. Please try again later.'), (StampedIllegalActionError, 403, 'invalid_request', 'An error occurred. Please try again later.'), (StampedMissingParametersError, 400, 'invalid_request', 'An error occurred. Please try again later'), (StampedPermissionsError, 403, 'forbidden', 'Insufficient privileges'),
def __init__(self): AMongoCollection.__init__(self, collection='userfaventities') self._cache = globalMemcache()