+# Declare a function to handle the replicate operation
+replicate() {
+ zfs_send="$1"
+ zfs_recv="$zfs receive -vF -d ${backup_pool}/${remote_pool}"
+ glue="$throttle $throttle_opt"
+ if [[ $throttle_enable == 1 && -e $throttle ]]; then
+ # handle using the glue in the local and remote host case properly
+ if [[ -z "$ssh" ]]; then
+ # local host glue case
+ $zfs_send | $glue | $zfs_recv
+ else
+ # remote host glue case
+ $ssh $remote "$zfs_send | $glue" | $zfs_recv
+ fi
+ else
+ # no glue case - works for both the local and remote host cases
+ $ssh $remote $zfs_send | $zfs_recv
+ fi
+ # The return code of the zfs_send | zfs_recv operation will be returned to the caller
+}
+