Exemplo n.º 1
0
        /// <summary>
        /// Begin executing the operation.
        /// </summary>
        public void StartOperation()
        {
            Debug.Assert(Status == MetaDataManagerStatus.Queued);
            Debug.Assert(TransferThread == null);
            Debug.Assert(Phase1Payload != null);
            Debug.Assert(Ticket != null);

            try
            {
                // Start the transfer.
                TransferThread = new KfsMetaDataThread(Share, Ticket, Phase1Payload);
                TransferThread.Start();

                Status = MetaDataManagerStatus.Exec;
                Phase1Payload = null;
                Ticket = null;
            }

            catch (Exception ex)
            {
                Share.FatalError(ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method is called when the operation has been completed.
        /// 'reason' is null if the thread has been cancelled.
        /// </summary>
        public void OnCompletion(bool successFlag, String reason, UInt64 commitID)
        {
            // Join with the transfer thread.
            Debug.Assert(TransferThread != null);
            TransferThread = null;

            // The operation failed.
            if (!successFlag)
            {
                ReportError(reason);
                Share.Pipeline.Run("meta-data execution failed", true);
            }

            // The operation succeeded.
            else
            {
                // We already got the server event. Call the handler function.
                if (CommitIDSet.Contains(commitID))
                    OnCommitIDReceived();

                // We're now waiting for the phase 1 event.
                else
                {
                    Status = MetaDataManagerStatus.Phase1;
                    WantedCommitID = commitID;
                }
            }
        }