agritheory/cloud_storage

File Version Control

Alchez opened this issue · 0 comments

Goal: Allow version control of files using Frappe and a cloud storage platform

Variables:

  • File Name: non-unique name assigned to a file object
  • Content Hash: unique content identifier for the file object

Flows

1. New filename, new hash

  1. User uploads a file
  2. Client makes a call to Frappe server to validate duplicate name and/or hash
  3. No file with filename or hash exists
  4. Continue file upload process and store in cloud platform
  5. Retrieve (if not available in response) and store the file's version ID (if applicable)

2. Existing filename, new hash

  1. User uploads a file
  2. Client makes a call to Frappe server to validate duplicate name and/or hash
  3. A file with the same filename is found, but with different hash
  4. Ask user for an input (create new file with new name, or override existing file and add version):
  • If new file:
    • Continue file upload process and store in cloud platform
    • Retrieve (if not available in response) and store the file's version ID (if applicable)
  • If override:
    • Continue file upload process and override the file object in the cloud platform
    • Retrieve (if not available in response) and store the file's new version ID (if applicable)

Rename-Replace


3&4. New/existing filename, existing hash

  1. User uploads a file
  2. Client makes a call to Frappe server to validate duplicate name and/or hash
  3. A file with the same unique hash is found, with the same or different file name
  4. Stop file upload process and show a link to the existing file

View-Exit


5. Rename file

  1. User clicks on "Rename" on a File record via the UI
  2. Client makes a call to Frappe server to validate duplicate name
  • If new filename is available:
    • Continue rename process and change name on cloud platform
    • Retrieve (if not available in response) and store the file's new version ID (if applicable)
  • If new filename exists:
    • Ask user for an input (new filename)
    • Continue rename process and change name on cloud platform
    • Retrieve (if not available in response) and store the file's new version ID (if applicable)

File Manager