hypercore-protocol / cli

A CLI for peer-to-peer file sharing using the Hypercore Protocol.
MIT License
205 stars 17 forks source link

Confused by `hyp drive rm hyper://...` - Cannot delete synced drive. #20

Closed Jolg42 closed 3 years ago

Jolg42 commented 3 years ago

Examples from a computer where I synced to (ie source is on the other computer).

hyp drive rm hyper://...
Accessing network...
Error: Cannot delete the root folder

hyp drive rm -r hyper://...
Accessing network...
Error: Cannot delete the root folder

hyp drive rmdir hyper://...
Accessing network...
Error: Cannot delete the root folder

hyp drive rmdir -r hyper://...
Error: URL is required

I want to delete this drive from this computer but it seems that I cannot. What should I do?

I'm curious to know where the drive is located on the filesystem (here macOS)?

pfrazee commented 3 years ago

Ah, interesting. So let me answer your 2nd question first.

I'm curious to know where the drive is located on the filesystem (here macOS)?

In the ~/.hyperspace folder, you'll find the "internal database." The hyper technology is a kind of database that acts like different things -- kind of like, for instance, if you built a filesystem on top of MySQL. (It's less insane than doing that but you get the idea.) So when you're interacting with a hyperdrive, you're interacting with that database.

It might help to think of "hyperdrives" as virtual folders.

Expanding a little more on that for those interested The "files" are stored in hyper's internal storage, and would look like nothing interesting if you looked at them. Another metaphor- it's kind of like how a .zip file contains lots of files inside it, but with hyper it's like 5-10 internal files with bits of data scattered around. It's done this way to make the hyper database as fast as possible.

I want to delete this drive from this computer but it seems that I cannot. What should I do?

So the drive rm command only deletes files inside of a hyperdrive, though intuitively I understand why you expected it to delete the drive itself.

We don't have a "delete drive" command yet, @andrewosh let's plan to talk through how that would work

Jolg42 commented 3 years ago

Thanks @pfrazee for the details!

Here is a snapshot of ~/.hyperspace for the curious (kinda looks like Spotify's cache 😄)

So I guess for now if I want to a complete cleanup rm -r ~/.hyperspace should do the trick.

Screen Shot 2020-12-14 at 16 57 05
pfrazee commented 3 years ago

@Jolg42 if you want to do a big unrecoverable nuke, that'd do it!