blob sholud not deleted after filteration. It should only deleted from local folder if it is deleted from the container RRS feed

  • Question

  • Hi i am doing sync from blob to local using sample code from the following link http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3638

    if am also doing filteration during the sync from the blob to local. by changeinf in the ListBlob method like this:
    if (isValidToSync)
        ItemFieldDictionary dict = new ItemFieldDictionary();
        dict.Add(new ItemField(ItemFields.CUSTOM_FIELD_NAME, typeof(string), o.Uri.ToString()));
        dict.Add(new ItemField(ItemFields.CUSTOM_FIELD_TIMESTAMP, typeof(ulong), (ulong)blob.Properties.LastModifiedUtc.ToBinary()));
    if blob in my container satisfy my requirement then i return isValidToSync True and then this blob will be added to List for downloading or sync.

    Now i am trying to explain my problem let us say if i have total two blobs which fullfill my requirement then these two blobs successfull downloaded from blob to local folder and after the specific time interval i again start blob synchronization throug the timer. and when syns again start then one of the above downloaded blob not fullfill my requirement so at this time only one blob is attached with list which is alreadyy downloaded. So my problem is that syncframwork deleted the blob which not fullfill my requirment.

    so i dont want to delete that blob which have downloaded once because may be next time same blob again satisfy my requirment. so again it will be downloaded. which will waste time. Only blob should be deleted if it is not in my azure container.

    Hope you guys understand my issue.



    Wednesday, June 9, 2010 8:47 AM


All replies

  • The way you use will cause the 2nd sync to delete the download blob because the 2nd time, the other blob is not reported to full enumeration framework so the framework regard this as a delete.

    You will need to implement filtered sync for the blob simple sync provider by specifying what should be or not be included in the sync. Please take a look at http://msdn.microsoft.com/en-us/library/dd937158(v=SQL.105).aspx 

    Wednesday, June 9, 2010 7:44 PM
  • Hi thanx for your reply but i cannot clearly understand your answer that how can i implement filtered sync for blob? Plz can you provide any sample code? It would be very nice if you provide me any sample application  which can resolved resolved my issue . I will be very thankfull to you because i am very worried about this issue and i have stuck now and dont know how to resolve this issue. Hope you will help me.



    Thursday, June 10, 2010 3:55 AM
  • For the AzureBlobSyncProvider,
    AzureBlobSyncProvider : FullEnumerationSimpleSyncProvider
    You can also implement the IFilteredSimpleSyncProvider like this:

    AzureBlobSyncProvider : FullEnumerationSimpleSyncProvider, IFilteredSimpleSyncProvider

    For the IsItemInFilterScope,  you can return true to include the item in the filter and false to not include them.

            SimpleSyncProviderFilterOptions IFilteredSimpleSyncProvider.FilterOptions
                    return SimpleSyncProviderFilterOptions.None;

            bool IFilteredSimpleSyncProvider.IsItemInFilterScope(ItemFieldDictionary KeyAndVersion)
                IDictionary<uint, ItemField> map = KeyAndVersion as IDictionary<uint, ItemField>;
                if ((UInt32)map[1].Value == 98052)
                    return false;

                return true;

    However, I haven't tried this with this sample so it's not guarrenteed to work. This sample uses file sync provider as one end and full enumeration provider as the other end so even though adding filter on the full enumeration provider end may be possible, this is never tested.

    Thursday, June 10, 2010 5:07 PM
  • Hi thanx for your reply i have tried your code but it giving followilg error

    Error 3 'Dynamax.DsNet.SyncFramework.AzureBlobSyncProvider' does not implement interface member 'Microsoft.Synchronization.SimpleProviders.IFilteredSimpleSyncProvider.UseFilterThisSession'

    plz can you tell me about this how can i resolve this?


    Friday, June 11, 2010 4:21 AM
  • There is a Property IFilteredSimpleSyncProvider.UseFilterThisSession that also needs to be implemented on that interface. Please take a look at the interface definition: http://msdn.microsoft.com/en-us/library/microsoft.synchronization.simpleproviders.ifilteredsimplesyncprovider.aspx.

    Friday, June 11, 2010 5:53 PM