Persistent stub for the Python datastore API.
Stores all entities in memory, and persists them to a file as pickled
protocol buffers. A DatastoreFileStub instance handles a single app's data
and is backed by files on disk.
def google.appengine.api.datastore_file_stub.DatastoreFileStub.__init__ |
( |
|
self, |
|
|
|
app_id, |
|
|
|
datastore_file, |
|
|
|
history_file = None , |
|
|
|
require_indexes = False , |
|
|
|
service_name = 'datastore_v3' , |
|
|
|
trusted = False , |
|
|
|
consistency_policy = None , |
|
|
|
save_changes = True , |
|
|
|
root_path = None , |
|
|
|
use_atexit = True , |
|
|
|
auto_id_policy = datastore_stub_util.SEQUENTIAL |
|
) |
| |
Constructor.
Initializes and loads the datastore from the backing files, if they exist.
Args:
app_id: string
datastore_file: string, stores all entities across sessions. Use None
not to use a file.
history_file: DEPRECATED. No-op.
require_indexes: bool, default False. If True, composite indexes must
exist in index.yaml for queries that need them.
service_name: Service name expected for all calls.
trusted: bool, default False. If True, this stub allows an app to
access the data of another app.
consistency_policy: The consistency policy to use or None to use the
default. Consistency policies can be found in
datastore_stub_util.*ConsistencyPolicy
save_changes: bool, default True. If this stub should modify
datastore_file when entities are changed.
root_path: string, the root path of the app.
use_atexit: bool, indicates if the stub should save itself atexit.
auto_id_policy: enum, datastore_stub_util.SEQUENTIAL or .SCATTERED
def google.appengine.api.datastore_file_stub.DatastoreFileStub.Read |
( |
|
self | ) |
|
Reads the datastore and history files into memory.
The in-memory query history is cleared, but the datastore is *not*
cleared; the entities in the files are merged into the entities in memory.
If you want them to overwrite the in-memory datastore, call Clear() before
calling Read().
If the datastore file contains an entity with the same app name, kind, and
key as an entity already in the datastore, the entity from the file
overwrites the entity in the datastore.
Also sets each ID counter to one greater than the highest ID allocated so
far in that counter's ID space.