checkFile

Purpose

Ask the P4ALTSYNC agent if a file has been hydrated and modified.

Input to agent

Key

Value

altSync checkFile
client The client workspace name
port The P4PORT the client used to connect to the server
user The P4USER the client used to connect to the server
path The local syntax path of the file to create a placeholder for
clientDepotFile

The depot syntax path of the file being diffed (the file the server believes the client to have)

clientDepotRev The revision number of the file being diffed (the file the server believes the client to have)
digest The server’s digest for depotFile (this is the MD5 of the file as it’s stored on the server) - Only if the server has a digest to send

The command might or might not include additional keys.

Action for the agent to perform

Commands like diff, reconcile and revert can test a file by filesize, digest, modified date to see if it’s changed before doing more intensive file transfers. The client-side part of this logic calls out to the P4ALTSYNC agent to see whether the file hasn’t been hydrated and the P4API should avoid triggering the hydration.

  • If the file has been deleted, the diff result should be missing to skip any further probing of the file.

  • If the file has been hydrated the result should be exists causing the P4API’s checkFile logic to continue to process the hydrated file.

  • If the file hasn’t been hydrated AND the provided digest matches the one that was provided on the altsync=add placeholder creation, return the diff result as same.

  • If the file hasn’t been hydrated BUT the provided digest doesn’t match the one that was provided on the altsync=add placeholder creation, return the diff result as virtual to tell the server that the client’s file is the same as the 'have' record (see p4 have), but it’s not actually on the client. This will cause further diffing to be performed between files on the server.

Output from the agent

Key

Value

result Boolean true for success
error Description of what went wrong (only applicable if the result is boolean false or the string literal "error")
checkFile

missing if the file, whether placeholder or hydrated, is deleted locally

exists if the file has been hydrated

same if the file hasn’t been hydrated and this digest matches

virtual if the file hasn’t been hydrated and the digest in this command differs from the digest sent when the placeholder was created or last updated

Example of input and output

{"altSync":"checkFile","client":"vfs-cmr5","clientDepotFile":"//depot/test+k.txt","clientDepotRev":2,"digest":"C88BED686B904EC55216E8D200E607F8","path":"e:\\temp\\vfs\\cmr5\\test+k.txt","port":"perforce:1666","user":"npoole"}
{"result":true,"checkFile":"same"}