Example #1
0
        //private void RecordCollisionConflict(SaveChangeContext context, MegaStoreConstraintException e)
        //{
        //    var existingItem = e.Node == null ? null :
        //        _metadataStore.FindItemMetadataByNodeId(e.Node.Node.Id);
        //    if (existingItem != null)
        //    {
        //        // ConstraintConflictReason.Collision does not fire the collision resolver!!!11
        //        context.RecordConstraintConflictForItem(existingItem.GlobalId, ConstraintConflictReason.Other);
        //    }
        //    else
        //    {
        //        context.RecordRecoverableErrorForItem(new RecoverableErrorData(e));
        //    }
        //}
        //private void RecordConcurrencyConflict(SaveChangeContext context, MegaStoreConcurrencyException e)
        //{
        //    var existingItem = e.Node == null ? null :
        //        _metadataStore.FindItemMetadataByNodeId(e.Node.Node.Id);
        //    // try to handle in a regular way
        //    if (existingItem != null)
        //    {
        //        context.RecordConstraintConflictForItem(existingItem.GlobalId, ConstraintConflictReason.Other);
        //    }
        //    // we are doomed!
        //    else
        //    {
        //        context.RecordRecoverableErrorForItem(new RecoverableErrorData(e));
        //    }

        //}
        #endregion

        #region default implementation of interfaces
        public ChangeApplier(MetadataStore metadataStore, SyncIdFormatGroup idFormats, NodeStore nodeStore)
        {
            _metadataStore  = metadataStore;
            _idFormats      = idFormats;
            _nodeStore      = nodeStore;
            AssumeSameFiles = true;
        }
        public MegaKnowledgeProvider(NodeStore store)
        {
            _nodeStore = store;

            _idFormats = new SyncIdFormatGroup();
            _idFormats.ChangeUnitIdFormat.IsVariableLength = false;
            _idFormats.ChangeUnitIdFormat.Length = 4;
            _idFormats.ItemIdFormat.IsVariableLength = false;
            _idFormats.ItemIdFormat.Length = 24;
            _idFormats.ReplicaIdFormat.IsVariableLength = false;
            _idFormats.ReplicaIdFormat.Length = 16;

            _metadataStore = new MetadataStore(_idFormats);
            _changeApplier = new ChangeApplier(_metadataStore, _idFormats, _nodeStore);
            _changeApplier.AppliedChange += OnAppliedChange;
            _changeApplier.DemandedResync += (s,e) => NeedResync = true;

            //Configuration.CollisionConflictResolutionPolicy =
        }
        public MegaKnowledgeProvider(NodeStore store)
        {
            _nodeStore = store;

            _idFormats = new SyncIdFormatGroup();
            _idFormats.ChangeUnitIdFormat.IsVariableLength = false;
            _idFormats.ChangeUnitIdFormat.Length           = 4;
            _idFormats.ItemIdFormat.IsVariableLength       = false;
            _idFormats.ItemIdFormat.Length = 24;
            _idFormats.ReplicaIdFormat.IsVariableLength = false;
            _idFormats.ReplicaIdFormat.Length           = 16;

            _metadataStore = new MetadataStore(_idFormats);
            _changeApplier = new ChangeApplier(_metadataStore, _idFormats, _nodeStore);
            _changeApplier.AppliedChange  += OnAppliedChange;
            _changeApplier.DemandedResync += (s, e) => NeedResync = true;

            //Configuration.CollisionConflictResolutionPolicy =
        }
Example #4
0
        //private void RecordCollisionConflict(SaveChangeContext context, MegaStoreConstraintException e)
        //{
        //    var existingItem = e.Node == null ? null :
        //        _metadataStore.FindItemMetadataByNodeId(e.Node.Node.Id);
        //    if (existingItem != null)
        //    {
        //        // ConstraintConflictReason.Collision does not fire the collision resolver!!!11
        //        context.RecordConstraintConflictForItem(existingItem.GlobalId, ConstraintConflictReason.Other);
        //    }
        //    else
        //    {
        //        context.RecordRecoverableErrorForItem(new RecoverableErrorData(e));
        //    }
        //}
        //private void RecordConcurrencyConflict(SaveChangeContext context, MegaStoreConcurrencyException e)
        //{
        //    var existingItem = e.Node == null ? null :
        //        _metadataStore.FindItemMetadataByNodeId(e.Node.Node.Id);
        //    // try to handle in a regular way
        //    if (existingItem != null)
        //    {
        //        context.RecordConstraintConflictForItem(existingItem.GlobalId, ConstraintConflictReason.Other);
        //    }
        //    // we are doomed!
        //    else
        //    {
        //        context.RecordRecoverableErrorForItem(new RecoverableErrorData(e));
        //    }

        //}
        #endregion

        #region default implementation of interfaces
        public ChangeApplier(MetadataStore metadataStore, SyncIdFormatGroup idFormats, NodeStore nodeStore)
        {
            _metadataStore = metadataStore;
            _idFormats = idFormats;
            _nodeStore = nodeStore;
            AssumeSameFiles = true;
        }