Syncer: a caching FUSE based filesystem in Rust

I’ve got a little further, making a tweak that I hope means I can manage without --exclude but think I’ve hit a more fundamental limitation that will go a bit far beyond my Rust ability.

It looks to me as if you cannot safe files sync to/from FilesContainer subpaths. Or maybe you can only sync a local directory to a FilesContainer but not the other way around. Can you confirm if these are or are not supported?

I’ve tried both with XOR URI and NRS URI and get the following errors:

Problem using xor URI:

"safe" "files" "sync" "-r" "safe://hnyynyib9mr43r7cthdodtci7kur7rgkc7ayzdkjax1j5dse451d3ft1wgbnc/data/nodes/" "/home/mrh/.syncer-test/data/nodes"
[2020-06-28T18:51:56Z ERROR safe] safe-cli error: [Error] InvalidXorUrl - Problem parsing the URL "safe:///home/mrh/.syncer-test/data/nodes": missing name

Problem using NRS URI:

"safe" "files" "sync" "--update-nrs" "-r" "safe://test1/data/nodes/" "/home/mrh/.syncer-test/data/nodes"
[2020-06-28T18:57:20Z ERROR safe] safe-cli error: [Error] InvalidXorUrl - Problem parsing the URL "safe:///home/mrh/.syncer-test/data/nodes": missing name
3 Likes

At this time, safe files sync only syncs local files to remote FileContainer, not vice-versa.

A rough workaround could be to download all files with safe files get <url> newdir, then rename/replace or rsync newdir to olddir.

5 Likes

I’ll have a think it that’s feasible for Syncer, thanks.

What about sync from/to subpaths?

It might be better to spend my time adding CLI support for these features rather than crowbarring Syncer to get around them, but I’m not sure I want to spend the time it would take given other projects.

Might be a nice change though to learn some Rust. I’ll probably look at the CLI code and think about it. Are you the goto guy for CLI stuff? If so how hard do you think it would be for me to have a go at these kinds of enhancements given I’m a Rust novice, is it a no-no? (I’ve written a lot of code in the past, C++ is the closest to Rust. Wrote a lot of that before it became a standard, so without later features).

2 Likes

I looked at adding a Java based FUSE wrapper for Safe NFS a few years back. I got basic read only support working using the local REST client. I know it has all changed completely now, so I’ve not touched it again. Once the APIs stabilise, I’d like another look.

IMO, it is important to have a standard interface at the safe library level. The implementations for how this is extended for FUSE, caching and so forth can then be done later, by third parties, etc.

I’m afraid I’m not up to speed on what the safe libs currently support. I hope it is moving in this direction though. Layering up functionality likes this breeds a community of developers and their apps.

3 Likes

Option 1 update

I have syncer running and initialising its storage with SAFE using the CLI, but there are a couple of problems. These require some enhancements to the SAFE CLI, a bit beyond my Rust skills at the moment. I’ve raised an issue for one (#589) and given a +1 to another (#512), which should enable me to get syncer going so if you have Rust skills feel free to have a go. I am reading up on Rust and if I think I can do this I’ll have a go at one myself.

It would also be useful to be able to:

  • update multiple files specified on the safe files sync command line, though this is not essential and works by issuing the command multiple times instead (SAFE CLI issue #600)
  • suppress console output with --quiet (SAFE CLI issue #601)
6 Likes

Syncer Update

I’ve paused on Option 1 to investigate Option 2 while learning Rust which may enable me to have a go at either adding features to SAFE CLI to support Option 1, or to maybe try Option 2 which is much more tricky but would probably be a better solution.

I’m in the process of making a lot of notes about how Syncer works, and want to share the latest version of a diagram which summarises the syncer architecture:

6 Likes

I had something about this 2 years ago. We just gotta store the cache encryption key on the Safe Network:

5 Likes