---
name: "App::SD::ForeignReplica"
section: "3pm"
platform: "linux"
package: "sd"
version: "0.74-1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/App::SD::ForeignReplica"
---

# App::SD::ForeignReplica(3pm)

### integrate\_change $change $changeset

Given a change (and the changeset it's part of), this routine will load the push encoder for the foreign replica's type and call integrate\_change on it.

To avoid publishing prophet-private data, It skips any change with a record type that record\_type starts with '\_\_'.

This is probably a bug.

### record\_pushed\_transactions

Walk the set of transactions on the ticket whose id you've passed in, looking for updates by the 'current user' which happened after start\_time and before now. Then mark those transactions as ones that originated in SD, so we don't accidentally push them later.

- ticket

  - changeset

  - start\_time

  ### record\_pushed\_transaction $foreign\_transaction\_id, $changeset

Record that this replica was the original source of `$foreign_transaction_id`  (with changeset `$changeset`)

### foreign\_transaction\_originated\_locally $transaction\_id $foreign\_record\_id

Given a transaction id, will return true if this transaction originated in Prophet and was pushed to the foreign replica or originated in the foreign replica and has already been pulled to the Prophet replica.

This is a mapping of all the transactions we have pushed to the remote replica we'll only ever care about remote sequence #s greater than the last transaction # we've pulled from the remote replica once we've done a pull from the remote replica, we can safely expire all records of this type for the remote replica (they'll be obsolete)

We use this cache to avoid integrating changesets we've pushed to the  remote replica when doing a subsequent pull

### uuid\_for\_remote\_id $id

lookup the uuid for the remote record id. If we don't find it,  construct it out of the remote url and the remote uri path for the record id;

### record\_remote\_id\_for\_pushed\_record

When pushing a record created within the prophet cloud to a foreign replica, we need to do bookkeeping to record the prophet uuid to remote id mapping.
