Created
August 5, 2013 22:10
-
-
Save workmaster2n/6160042 to your computer and use it in GitHub Desktop.
Pseudo replication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # From remote | |
| Connect(home_base, username, password) | |
| last_id_replicated = SELECT highest_replicated_id FROM replication_information WHERE computer = self.name | |
| Connect(local_db, username, password) | |
| to_replicate = local_machine.SELECT * FROM tracked_points WHERE id > last_id_replicated | |
| to_replicate.every_thousand_records | |
| start_transaction | |
| INSERT INTO home_base.big_table (computer_name, x, y, recorded_at) VALUES (self.name, thousand_records.x, thousand_records.y, thousand_records.recorded_at) | |
| UPDATE replication_information SET last_updated_at = Time.now, highest_replicated_id = thousand_records.last.id WHERE computer_name = self.name | |
| end_transaction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment