示例#1
0
文件: SyncEngine.cs 项目: npenin/uss
        private void BeginInitializeInfo(AsyncCallback callback, IPersistenceEngineAsync engine)
        {
            Entity e = new Entity(SyncUtils.INFO);
            e.SetValue(SyncUtils.TRANSACTION, 0);
            e.SetValue(SyncUtils.CLIENTID, String.Empty);

            Transaction t = new Transaction(engine.FactoryAsync.Model);
            t.Serialize(e);
            t.BeginCommit(callback, engine, false, t);
        }
示例#2
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);
            }
        }