Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigate version history on a per-file basis #36

Closed
josephmturner opened this issue Jan 13, 2023 · 3 comments
Closed

Navigate version history on a per-file basis #36

josephmturner opened this issue Jan 13, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@josephmturner
Copy link
Contributor

One way to explore the history of a particular file:

Loop through hyperdrive version numbers, starting with the current version and going backwards. Check if drive.diff(...) returns non-null (we could use a HEAD request for this?). If so, checkout that version and display the file at that version or inform the user that the file didn't exist before that version.

What about the edge-case where a file was created, deleted, then created again? Can we just continue checking back in time until we get a non-null diff or we get to the beginning of the history?

Do you know of a better approach? I imagine that sending a new HTTP request to hyper-gateway on each loop could be slow.

@RangerMauve
Copy link
Owner

Hmm, not sure if HEAD would make sense here.

Let me think about diffs for a week or two.

@RangerMauve RangerMauve added the enhancement New feature or request label Jan 24, 2023
@josephmturner
Copy link
Contributor Author

To accomplish this, we could extrapolate on the ideas discussed here and here.

If the latest version of the drive is version 100 and user wants to checkout the version of /example.txt before the last change, send a GET request to hyper://public-key/$/previous/100/example.txt. Assuming that the most recent different version of /example.txt is version 42, this would have the same effect as GET hyper://public-key/$/version/42/example.txt. A HEAD request should return just the headers, allowing for a quick overview of the version history of particular file, including file sizes, modification dates, and version numbers.

Going forward through version history, GET hyper://public-key/$/previous/42/example.txt should give version 43. GET hyper://public-key/$/previous/42/example.txt should give version 100 (current).

@RangerMauve
Copy link
Owner

To get a diff we can use the ETag versins returned on a HEAD for a file.

  • Get the current version of the drive
  • Loop
  • HEAD on the hyper://key/$/version/${version}/${file_path}
  • If 404, break the loop
  • Get whatever file info you need from the HEAD response and log them
  • Set version to the ETag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants