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

ftp2mfs modifies data too much on target MFS #22

Open
kallisti5 opened this issue Dec 5, 2023 · 2 comments
Open

ftp2mfs modifies data too much on target MFS #22

kallisti5 opened this issue Dec 5, 2023 · 2 comments

Comments

@kallisti5
Copy link

Just noticed that ftp2mfs modifies the data too much.

config:

source:  rsync://stuff
target: /stuff

source:

   /stuff/things
   /stuff/thingsb
   /stuff/thingsc

destination:

   /stuff/data/things
   /stuff/data/thingsb
   /stuff/data/thingsc
   /stuff/lastsync
   /stuff/mirror
   /stuff/state

Wouldn't it make more sense to maintain the file structure and add a hidden state directory?

For example:
destination:

  /stuff/.ftp2mfs/lastsync
  /stuff/.ftp2mfs/mirror
  /stuff/.ftp2mfs/state
  /stuff/things
  /stuff/thingsb
  /stuff/thingsc
@jcaesar
Copy link
Owner

jcaesar commented Dec 5, 2023

I originally considered this. Here's why I didn't do that:
The way I used ftp2mfs was to sync, and then do ipfs files stat --hash /stuff/data and publishing that to ipfs name and some dnslinks.
With what you suggest, you'd do ipfs files stat --hash /stuff, but then the folder you publish would contain some weird extra files. I wouldn't like that.

You could of course sync to /.stuff-sync and then always copy /.stuff-sync/data to /stuff after syncing.

If you want to try patching that, does just making this bunch of functions

ftp2mfs/src/tomfs.rs

Lines 36 to 68 in d7b9c4a

fn curr(&self) -> &Path {
&self.settings.target
}
fn sync(&self) -> PathBuf {
self.workdir().join("sync")
}
fn prev(&self) -> PathBuf {
self.workdir().join("prev")
}
fn currdata(&self) -> PathBuf {
self.curr().join("data")
}
fn syncdata(&self) -> PathBuf {
self.sync().join("data")
}
fn currmeta(&self) -> PathBuf {
self.curr().join("state")
}
fn syncmeta(&self) -> PathBuf {
self.sync().join("state")
}
fn lastsync(&self) -> PathBuf {
self.sync().join("lastsync")
}
fn currpid(&self) -> PathBuf {
self.curr().join("pid")
}
fn piddir(&self) -> PathBuf {
self.sync().join("pid")
}
fn lockf(&self) -> PathBuf {
self.piddir().join(&self.id)
}

return the set of values you want work correctly? (There is some copy/modify/replace-original magic going on, so it might not.)

@kallisti5
Copy link
Author

Ah yeah, so my issue is i'm syncing several things from various locations into one set of directories i'm publishing to ipns.

  • rsync /thinga/master
  • rsync /thinga/release
  • s3 /thingb/master
  • s3 /thingb/release

Publish / -> ipns dnslink

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

No branches or pull requests

2 participants