Ported the Puller class.

The Puller was ported from the latest upstream changes.
As a result, some other upstream changes were brought over
to dependent classes like Database, Replication, etc.