Exemplo n.º 1
0
        //Methods

        /// <summary>
        /// Starts the <see cref="Couchbase.Lite.Replication"/>.
        /// </summary>
        public void Start()
        {
            if (!LocalDatabase.Open())
            {
                // Race condition: db closed before replication starts
                Log.W(Tag, "Not starting replication because db.isOpen() returned false.");
                return;
            }

            if (IsRunning)
            {
                return;
            }

            LocalDatabase.AddReplication(this);
            LocalDatabase.AddActiveReplication(this);
            sessionID = string.Format("repl{0:000}", ++lastSessionID);
            Log.V(Database.Tag, ToString() + " STARTING ...");
            IsRunning    = true;
            LastSequence = null;
            CheckSession();
        }