Module Expr Str Assign NameStore ListLoad Str Str Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str Assign NameStore ListLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Return Call NameLoad AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call NameLoad AttributeLoad NameLoad attr NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Expr Yield Call NameLoad NameLoad NameLoad NameLoad AttributeLoad NameLoad attr NameLoad keyword NameLoad decorator_list NameLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str Assert BoolOpAnd CompareIn Str NameLoad CompareIn Str NameLoad CompareIn Str NameLoad NameLoad Assert CompareIn Str NameLoad BinOpMod Str NameLoad Assert CompareIn Str NameLoad BinOpMod Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Raise Call AttributeLoad NameLoad attr NameLoad decorator_list NameLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str Assert BoolOpAnd CompareNotIn Str NameLoad CompareNotIn Str NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign NameStore Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad If CompareIs NameLoad NameLoad body If CompareEq NameLoad NameLoad body Raise Call NameLoad BinOpMod Str NameLoad orelse Assign NameStore Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad If BoolOpOr CompareIs NameLoad NameLoad UnaryOpNot Call AttributeLoad NameLoad attr body Raise Call AttributeLoad NameLoad attr NameLoad Raise Call AttributeLoad NameLoad attr NameLoad decorator_list NameLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore BoolOpOr NameLoad ListLoad For TupleStore NameStore TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareIsNot NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr If CompareGt Call NameLoad NameLoad Num body Assign SubscriptStore NameLoad Index Str Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore IfExp CompareGt Call NameLoad NameLoad Num AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad If BoolOpAnd CompareIsNot NameLoad NameLoad CompareLt Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad orelse Expr Call NameLoad TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body With Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad NameStore body For NameStore NameLoad body With Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameStore body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr keyword NameLoad keyword Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword Call AttributeLoad NameLoad attr keyword NameLoad decorator_list Expr Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad decorator_list NameLoad decorator_list AttributeLoad NameLoad attr
N/A N/A Viewfinder episode.

Episodes encompass a collection of photos separated by enough space
and/or time from previous or subsequent photos.

Episode ids are constructed from 32 bits of time, a variable-length-
encoded integer device id and a variable-length-encoded unique id from
the device. The final value is base64-hex encoded. They sort
lexicographically by timestamp (reverse ordered so the most recent
episodes are listed first in a query).

Photos are added to episodes via posts. A post is a composite-key
relation between an episode-id and a photo-id.

  Episode: a collection of photos contiguous in spacetime
 N/A __authors__ N/A spencer@emailscrubbed.com (Spencer Kimball) andy@emailscrubbed.com (Andy Kimball) N/A logging functools partial tornado gen viewfinder.backend.base util viewfinder.backend.base.exceptions InvalidRequestError PermissionError LimitExceededError viewfinder.backend.db vf_schema viewfinder.backend.db.accounting Accounting viewfinder.backend.db.asset_id IdPrefix ConstructTimestampAssetId viewfinder.backend.db.asset_id DeconstructTimestampAssetId VerifyAssetId viewfinder.backend.db.base DBObject viewfinder.backend.db.hash_base DBHashObject viewfinder.backend.db.follower Follower viewfinder.backend.db.notification Notification viewfinder.backend.db.operation Operation viewfinder.backend.db.photo Photo viewfinder.backend.db.post Post viewfinder.backend.db.user User viewfinder.backend.db.user_photo UserPhoto viewfinder.backend.db.user_post UserPost viewfinder.backend.db.versions Version viewfinder.backend.db.viewpoint Viewpoint Episode N/A DBHashObject N/A N/A Viewfinder episode data object. N/A __slots__ N/A N/A _table N/A N/A N/A DBObject _schema GetTable N/A vf_schema EPISODE __init__ N/A N/A self episode_id N/A None N/A N/A N/A N/A N/A super Episode self __init__ N/A N/A self episode_id episode_id N/A ConstructEpisodeId N/A N/A cls timestamp device_id uniquifier N/A N/A N/A Returns an episode id constructed from component parts. Episodes
    sort from newest to oldest. See "ConstructTimestampAssetId" for
    details of the encoding.
     N/A N/A ConstructTimestampAssetId N/A IdPrefix Episode timestamp device_id uniquifier N/A classmethod DeconstructEpisodeId N/A N/A cls episode_id N/A N/A N/A Returns the components of an episode id: timestamp, device_id, and
    uniquifier.
     N/A N/A DeconstructTimestampAssetId N/A IdPrefix Episode episode_id N/A classmethod VerifyEpisodeId N/A N/A cls client user_id device_id episode_id N/A N/A N/A Ensures that a client-provided episode id is valid according
    to the rules specified in VerifyAssetId.
     N/A N/A N/A VerifyAssetId client user_id device_id N/A IdPrefix Episode episode_id has_timestamp True N/A classmethod N/A gen coroutine CreateNew N/A N/A cls client N/A ep_dict N/A N/A Creates the episode specified by 'ep_dict'. The caller is responsible for checking
    permission to do this, as well as ensuring that the episode does not yet exist (or is
    just being identically rewritten).

    Returns: The created episode.
     N/A N/A N/A episode_id ep_dict N/A user_id ep_dict N/A viewpoint_id ep_dict ep_dict N/A N/A timestamp ep_dict N/A timestamp attribute required in episode: "%s" ep_dict N/A N/A publish_timestamp ep_dict N/A publish_timestamp attribute required in episode: "%s" ep_dict N/A episode N/A N/A Episode CreateFromKeywords ep_dict N/A N/A N/A N/A gen Task N/A episode Update client N/A N/A N/A gen Return episode N/A classmethod N/A gen coroutine UpdateExisting N/A N/A self client N/A ep_dict N/A N/A Updates an existing episode. N/A N/A N/A publish_timestamp ep_dict N/A parent_ep_id ep_dict ep_dict N/A N/A N/A self UpdateFromKeywords ep_dict N/A N/A N/A N/A gen Task N/A self Update client N/A N/A gen coroutine QueryIfVisible N/A N/A cls client user_id episode_id must_exist consistent_read N/A True False N/A N/A If the user has viewing rights to the specified episode, returns that episode, otherwise
    returns None. The user has viewing rights if the user is a follower of the episode's
    viewpoint. If must_exist is true and the episode does not exist, raises an InvalidRequest
    exception.
     N/A episode N/A N/A N/A gen Task N/A Episode Query client episode_id None must_exist False consistent_read consistent_read N/A N/A episode None N/A N/A N/A must_exist True N/A N/A N/A InvalidRequestError N/A Episode "%s" does not exist. episode_id N/A N/A follower N/A N/A N/A gen Task N/A Follower Query client user_id N/A episode viewpoint_id col_names None must_exist False N/A N/A N/A follower None N/A N/A N/A follower CanViewContent N/A N/A N/A N/A gen Return None N/A N/A N/A gen Return episode N/A classmethod N/A gen coroutine QueryPosts N/A N/A cls client episode_id user_id callback limit excl_start_key base_results N/A None None None N/A N/A Queries posts (up to 'limit' total) for the specified
    'episode_id', viewable by 'user_id'. The query is for posts starting
    with (but excluding) 'excl_start_key'. The photo metadata for each
    post relation are in turn queried and the post and photo metadata
    are combined into a single dict. The callback is invoked with the
    array of combined post/photo metadata, and the last queried post
    sort-key.

    The 'base_results' argument allows this method to be re-entrant.
    'limit' can be satisfied completely if a user is querying an
    episode they own with nothing archived or deleted. However, in cases
    where an episode hasn't been fully shared, or has many photos archived
    or deleted by the requesting user, QueryPosts needs to be re-invoked
    possibly many times to query 'limit' posts or reach the end of the
    episode.
     _OnQueryMetadata N/A N/A posts results N/A N/A N/A Constructs the photo metadata to return. The "check_label" argument
      is used to determine whether to use the old permissions model or the
      new one. If "check_label" is true, then only return a photo if a label
      is present. Otherwise, the photo is part of an episode created by
      the new sharing functionality, and the user automatically has access
      to all photos in that episode.
       N/A ph_dicts N/A base_results N/A N/A N/A post N/A photo user_post N/A zip posts results N/A N/A ph_dict N/A N/A photo _asdict N/A labels N/A N/A N/A post labels combine N/A N/A user_post None N/A N/A labels N/A N/A labels union N/A N/A N/A user_post labels combine N/A N/A N/A len labels 0 N/A N/A N/A ph_dict N/A labels N/A list labels N/A N/A N/A ph_dicts append ph_dict N/A last_key N/A N/A N/A len posts 0 N/A N/A posts N/A -1 photo_id None N/A N/A N/A last_key None N/A N/A len ph_dicts limit N/A N/A N/A N/A Episode QueryPosts client episode_id user_id callback limit limit excl_start_key last_key base_results ph_dicts N/A N/A N/A callback N/A ph_dicts last_key N/A _OnQueryPosts N/A N/A posts N/A N/A N/A N/A N/A util ArrayBarrier N/A partial _OnQueryMetadata posts b N/A N/A post posts N/A N/A N/A N/A util ArrayBarrier N/A N/A b Callback metadata_b N/A N/A post_id N/A N/A Post ConstructPostId N/A post episode_id N/A post photo_id N/A N/A N/A Photo Query client hash_key N/A post photo_id col_names None callback N/A N/A metadata_b Callback N/A N/A N/A UserPost Query client hash_key user_id range_key post_id col_names None callback N/A N/A metadata_b Callback must_exist False N/A N/A N/A N/A Post RangeQuery client hash_key episode_id range_desc None limit limit col_names None callback _OnQueryPosts excl_start_key excl_start_key N/A classmethod N/A N/A DBObject map_table_attributes