App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
google.appengine.datastore.datastore_stub_index.IndexYamlUpdater Class Reference
Inheritance diagram for google.appengine.datastore.datastore_stub_index.IndexYamlUpdater:

Public Member Functions

def __init__
 
def UpdateIndexYaml
 

Public Attributes

 root_path
 
 last_history_size
 

Static Public Attributes

 index_yaml_is_manual = False
 
 index_yaml_mtime = None
 
int last_history_size = 0
 

Detailed Description

Helper class for updating index.yaml.

This class maintains some state about the query history and the
index.yaml file in order to minimize the number of times index.yaml
is actually overwritten.

Constructor & Destructor Documentation

def google.appengine.datastore.datastore_stub_index.IndexYamlUpdater.__init__ (   self,
  root_path 
)
Constructor.

Args:
  root_path: Path to the app's root directory.

Member Function Documentation

def google.appengine.datastore.datastore_stub_index.IndexYamlUpdater.UpdateIndexYaml (   self,
  openfile = open 
)
Update index.yaml.

Args:
  openfile: Used for dependency injection.

We only ever write to index.yaml if either:
- it doesn't exist yet; or
- it contains an 'AUTOGENERATED' comment.

All indexes *before* the AUTOGENERATED comment will be written
back unchanged.  All indexes *after* the AUTOGENERATED comment
will be updated with the latest query counts (query counts are
reset by --clear_datastore).  Indexes that aren't yet in the file
will be appended to the AUTOGENERATED section.

We keep track of some data in order to avoid doing repetitive work:
- if index.yaml is fully manual, we keep track of its mtime to
  avoid parsing it over and over;
- we keep track of the number of keys in the history dict since
  the last time we updated index.yaml (or decided there was
  nothing to update).

The documentation for this class was generated from the following file: