Beispiel #1
0
        /// <summary>
        /// Обмен схем репликации текущего узла с узлом storageHost.
        /// </summary>
        /// <param name="remoteNode">Удаленный узел хранилища.</param>
        /// <param name="currentReplicationSchema">Схема репликации текущего узла.</param>
        /// <returns></returns>
        public IReplicationSchema ExchangeSchema(IStorageNode remoteNode, IReplicationSchema currentReplicationSchema)
        {
            if (remoteNode == null)
            {
                throw new ArgumentNullException("remoteNode");
            }

            if (currentReplicationSchema == null)
            {
                throw new ArgumentNullException("currentReplicationSchema");
            }

            return(this.MakeRequest(x =>
            {
                //схема репликации сети, известная текущему узлу
                WcfReplicationSchema typedCurrentReplicationSchema =
                    new WcfReplicationSchema(currentReplicationSchema);
                WcfReplicationSchemaMessage exchangeMessage =
                    new WcfReplicationSchemaMessage(typedCurrentReplicationSchema);
                //посылаем текущую схему узлу, к которому обращаемся
                //и получаем его схему с узла назначения
                WcfReplicationSchemaMessage remoteSchemaMessage =
                    x.ExchangeSchema(exchangeMessage);
                return new WcfReplicationSchema(remoteSchemaMessage);
            }, remoteNode.Host));
        }
        public WcfReplicationSchemaMessage(WcfReplicationSchema schema)
        {
            if (schema == null)
            {
                throw new ArgumentNullException("schema");
            }

            this.Schema = schema;
        }
        public WcfReplicationSchemaMessage ExchangeSchema(WcfReplicationSchemaMessage remoteSchemaMessage)
        {
            if (remoteSchemaMessage == null)
            {
                throw new ArgumentNullException("remoteSchemaMessage");
            }

            WcfReplicationSchema        remoteSchema       = new WcfReplicationSchema(remoteSchemaMessage);
            IReplicationSchema          currentSchema      = this.ReplicationAdapter.UpdateReplicationSchema(remoteSchema);
            WcfReplicationSchema        typedCurrentSchema = new WcfReplicationSchema(currentSchema);
            WcfReplicationSchemaMessage responseMessage    = new WcfReplicationSchemaMessage(typedCurrentSchema);

            return(responseMessage);
        }