How does it work

mdornseif edited this page Jan 8, 2012 · 2 revisions

AppRocket performs a replication in two cycles:

  • Receive – new and updated AppEngine entity instances are replicated to MySQL database.
  • Send – new and updated MySQL records are replicated to AppEngine datastore.

The replication is performed by two components:

  • AppEngine application extension – running inside AppEngine application,
  • Replication services managed by script – running on your server (such as VPS or physical machine).

Each AppEngine entity instance is replicated to it’s own table in MySQL and vice versa. Each AppEngine list property is replicated to and from a separate table in MySQL. Each list value maps to a single record in this table and each list record has a key referencing to it’s owner entity.

During receive cycle, MySQL database table structures are initialized and updated automatically to match the entities replicated from AppEngine.

Entity instances in AppEngine are looked up based on a timestamp field, that should be defined as

timestamp = db.DateTimeProperty(auto_now=True, indexed=True)

This property is required for every entity that needs to be replicated. Similiarly each MySQL table that needs to be replicated to AppEngine must have a column with type TIMESTAMP.