Detecting Deleted Items

The metadata storage service supplies a delete detection service to help providers that represent replicas that do not track deletes of items. This service determines which items were deleted from the replica so that they can be marked as deleted in the metadata store.

Algorithm to Detect Deletes

The delete detector uses the following high-level algorithm for detecting deleted items:

  1. It records all items that are reported as active. An item is reported as active when its metadata is changed and saved or when the provider explicitly reports it as active.

  2. Any metadata entry that is not active is reported as deleted.

  3. The provider enumerates the inactive metadata entries and marks them as deleted.

Detecting Deletes by Using Managed Code

The delete detector can be accessed through the DeleteDetector property of the ReplicaMetadata object.

To reset the delete detector for a new detection pass, call MarkAllItemsUnreported.

An active metadata entry exists implicitly for an item when it has been changed and saved by using SaveItemMetadata(ItemMetadata). An item can explicitly be kept active, even if it was not changed, by calling ReportLiveItemById(SyncId).

Get the list of items that are currently detected as deletes by calling FindUnreportedItems. The items in this list must be marked as deleted in the metadata store by using MarkAsDeleted(SyncVersion).

Detecting Deletes by Using Unmanaged Code

The delete detector is part of the IReplicaMetadata object.

To reset the delete detector for a new detection pass, call IReplicaMetadata::ResetReportingWatermark.

An active metadata entry exists implicitly for an item when it has been changed and saved by using IReplicaMetadata::SaveItemMetadata. An item can explicitly be kept active, even if it was not changed, by calling IReplicaMetadata::ReportLiveItemByGlobalId.

Get the list of items that are currently detected as deletes by calling IReplicaMetadata::GetUnreportedItems. The items in this list must be marked as deleted in the metadata store by using IItemMetadata::MarkAsDeleted.

Vea también

Referencia

ReplicaMetadata

DeleteDetector

Otros recursos

Sync Framework Metadata Storage Service

IReplicaMetadata interface