++ed by:

1 PAUSE user

Christine Spang
and 1 contributors

save_username_and_token( $username, $token )

Saves the given username and token to the replica-specific config file, so the user doesn't have to enter it every time.

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.


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.


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;


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.


Loop on prompting for username/password until login is successful; user can abort with ^C.

Saves username and password to the replica's configuration file upon successful login.

params: - uri # login url - username # optional; a pre-seeded username - password # optional; a pre-seeded password - username_prompt # optional; custom username prompt - secret_prompt # optional; custom secret prompt - login_callback # coderef of code that attempts login; should throw exception # on error - catch_callback # optional; process thrown exception message (e.g. munge # in some way and then print to STDERR)

returns: ($username, $password)

extract_auth_from_uri( $uri_string )

Given a server URI string, possibly containing auth info, extract the auth info if it exists.

Also sets the remote_url and url attribute to the server URI with the auth information removed.

returns: ($username, $password)