示例#1
0
文件: SyncEngine.cs 项目: npenin/uss
        public override void BeginProcessCommands(Transaction tx, AsyncCallback callback, object asyncState)
        {
            WaitForAll waitForAllCallback = new WaitForAll(callback, asyncState);
            base.BeginProcessCommands(tx, waitForAllCallback.Callback("engine"), asyncState);

            Transaction t;
            SyncCommandProcessor syncCommandProcessor;

            GenerateTransactionId(metadataEngine);

            t = new Transaction(metadataEngine.Factory.Model);
            syncCommandProcessor = new SyncCommandProcessor(this, t, lastTransactionId);

            foreach (Command c in tx.PendingCommands)
            {
                // Ignores commands in metadata
                if (c.IgnoreMetadata || ignoreClientMetadata)
                    continue;

                syncCommandProcessor.Visit(c);
            }

            t.BeginCommit(waitForAllCallback.Callback("metadata"), metadataEngine, false, t);

            if (secondaryMetadataEngine != null)
            {
                GenerateTransactionId(secondaryMetadataEngine);

                t = new Transaction(secondaryMetadataEngine.Factory.Model);
                syncCommandProcessor = new SyncCommandProcessor(this, t, lastTransactionId);

                foreach (Command c in tx.PendingCommands)
                {
                    syncCommandProcessor.Visit(c);
                }

                t.BeginCommit(waitForAllCallback.Callback("metadata2"), secondaryMetadataEngine, false, t);
            }
        }
示例#2
0
文件: SyncEngine.cs 项目: npenin/uss
        public override void ProcessCommands(Transaction tx)
        {
            base.ProcessCommands(tx);

            Transaction t;
            SyncCommandProcessor syncCommandProcessor;

            GenerateTransactionId(metadataEngine);

            t = new Transaction(metadataEngine.Factory.Model);
            syncCommandProcessor = new SyncCommandProcessor(this, t, lastTransactionId);

            foreach (Command c in tx.PendingCommands)
            {
                // Ignores commands in metadata
                if (c.IgnoreMetadata || ignoreClientMetadata)
                    continue;

                syncCommandProcessor.Visit(c);
            }

            t.Commit(metadataEngine, false);

            if (secondaryMetadataEngine != null)
            {
                GenerateTransactionId(secondaryMetadataEngine);

                t = new Transaction(secondaryMetadataEngine.Factory.Model);
                syncCommandProcessor = new SyncCommandProcessor(this, t, lastTransactionId);

                foreach (Command c in tx.PendingCommands)
                {
                    syncCommandProcessor.Visit(c);
                }

                t.Commit(secondaryMetadataEngine, false);
            }
        }