dat icon indicating copy to clipboard operation
dat copied to clipboard

[cmd] CHECKPOINT - create a checkpoint/tag/version (or backup to another dir)

Open joehand opened this issue 7 years ago • 0 comments

From @joehand on December 20, 2016 0:43

Through our meeting and presentations it seems like version history is pretty important, even something basic. Basic versioning would require:

  • Storing historic files somewhere
  • Keeping a log of tags/checkpoints
  • Ability to look at files from a specific tag/checkpoint

We have a pending PR in hyperdrive to add checkpoints. But that will still require saving the files somewhere to checkout.

I made dat-backup to try to solve the storage issues using hypercore-archiver. The cool part (and why I was so motivated to start this with hypercore-archiver) is that we can use the Svalbard type infrastructure to selectively store backups on different machines. I could give my changes feed to a Svalbard-type server and give criteria on what to backup!!

Usage & Implementation

Most of this is already implemented in dat-backup, its just a matter of cleaning up and changing the commands to suit dat-next.

You'd run backup in a directory with an existing archive:

dat-next backup --name "first backup"

This will copy the files and create a snapshot archive inside dir/.dat-backups/<static-key>. It will also append to the changes feed:

{ "key": "<static-key>", "type": "add", "data": { "name": "first backup"}}

When hyperdrive checkout PR merges, we can append the same data the hyperdrive feed.

To list backups you could do:

dat-next backup --list

Prints out:

Backups

First backup
  4f86658db9f1a738832c7488a9d3c096dc4f3af1633b43cfa581184dbfaffdcd

-----------
Backup Feed
  1 Active Backup
  Key: 50fdc4987ea2989417e393ff029129c4377cc8a93295da3c61cbeda7930d51fb
-----------

Where backup feed is the hypercoe-archiver changes feed and the 4f866... key is the snapshot key for the backup.

This would allow us to serve the backups over the Dat network:

dat-next backup --serve

And someone else could run

dat-next clone 4f86658db9f1a738832c7488a9d3c096dc4f3af1633b43cfa581184dbfaffdcd

Users can clone the backup as if it was a regular archive (since it is). This would allow a user to clone their own backups as a minimal way checkout old files. But we could also alias a dat-next checkout type command to the clone command.

Copied from original issue: joehand/dat-next#46

joehand avatar Feb 16 '17 00:02 joehand