locked
Where do I store custom data in Cloud Files Placeholder (cfapi)? RRS feed

  • Question

  • I need to store a ETag inside a placeholder. So I can send it together with the file content to the server when content is updated on the client. 

    Is storing such data in CF_PLACEHOLDER_CREATE_INFO.FileIdentity would be a proper approach or are there any other place for this?


    Friday, July 24, 2020 7:27 AM

All replies

  • Hello WebDAV,

    Based on the document CF_PLACEHOLDER_CREATE_INFO.FileIdentity can be used for storing custom data for a file like relativeName used in official sample CloudMirror.

    Another possible solution is using metadata.

    Could you share your purpose of storing a ETag? So we may find a more suitable solution for you.

    [This “Windows Desktop SDK” Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.]

    Best regards,

    Rita


    "Win32 API" forum will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "Win32 API" forum’s new home on Microsoft Q&A !
    For more information, please refer to the sticky post.

    Monday, July 27, 2020 2:30 AM
  • Here is my scenario:

    1. The file content is synced to client from server, together with the ETag.
    2. The file content is modified on the client.
    3. The modified file content is sent from client to the server. To make sure the server content is not modified, the client sends the ETag inside If-Match header, together with content. Update fails if server and client Etags do not match.
    Monday, July 27, 2020 4:06 AM
  • Hello WebDAV,

    Thanks for your confirmation.

    For checking or comparing if there is a difference in a file between client and server, there seems no such ETag out of box in Cloud Sync Engine APIs. So custom implementation is required. CF_PLACEHOLDER_CREATE_INFO.FileIdentity looks fine for this purpose.

    [This “Windows Desktop SDK” Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.]

    Best regards,

    Rita


    "Win32 API" forum will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "Win32 API" forum’s new home on Microsoft Q&A !
    For more information, please refer to the sticky post.


    Monday, July 27, 2020 8:17 AM
  • To read FileIdentity I am using CfOpenFileWithOplock() call to get the placeholder handler and than call CfGetPlaceholderInfo() function. But it looks like the CfOpenFileWithOplock() call is causing the placeholder hydration, which is an undesired behavior. How do I read the FileIdentity without hydrating the placeholder?


    Thursday, July 30, 2020 5:15 AM
  • Hello WebDAV,

    You can use CreateFile to get the FileHandle instead of using CfOpenFileWithOplock.

    CreateFile(fileName, 0, FILE_READ_DATA, nullptr, OPEN_EXISTING, 0, nullptr);

    Please let me know if it helps.

    [This “Windows Desktop SDK” Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.]

    Best regards,

    Rita


    "Win32 API" forum will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "Win32 API" forum’s new home on Microsoft Q&A !
    For more information, please refer to the sticky post.

    Monday, August 3, 2020 9:38 AM