If you are on a Mac, install FUSE from https://osxfuse.github.io. Then do the following:
sudo ln -s /usr/local/lib/pkgconfig/fuse.pc /usr/local/lib/pkgconfig/osxfuse.pc
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
Now you can run cargo check
and it won’t complain not being able to
find osxfuse.pc.
The executable takes a single argument, the configuration file. The configuration file (a JSON file) should look something like this:
{
"my_address": "127.0.0.1",
"peers": {},
"mount_point": "/Users/yuan/p/cse223/monovault/mount",
"db_path": "/Users/yuan/p/cse223/monovault/db",
"local_vault_name": "pandora",
"caching": false,
"share_local_vault": false,
"allow_disconnected_delete": false,
"allow_disconnected_create": false,
"background_update_interval": 3
}
"my_address" and "peers" is not yet used, "mount_point" is where you want to mount the file system. "db_path" is a directory that contains all the cache and database, obviously it shouldn’t be under the mount point. "local_vault_name" is just what it is, the name of the local vault.
Run the file system like this:
cargo run -- -c /path/to/config.json
where config.json
is the configuration file. To enable logging, set
RUST_LOG
. For example,
RUST_LOG="warn,monovault::fuse=info" cargo run -- -c /path/to/config.json
This should log all the calls made by FUSE.
To stop the file system, just manually unmount the filesystem. To unmount (on mac):
umount -f /path/to/mount/point
Now we run two instances of monovault locally. Instance A:
{
"my_address": "127.0.0.1:7771",
"peers": {
"moon": "http://127.0.0.1:7772"
},
"mount_point": "/Users/yuan/p/cse223/monovault/mount",
"db_path": "/Users/yuan/p/cse223/monovault/db",
"local_vault_name": "pandora",
"caching": false,
"share_local_vault": true,
"allow_disconnected_delete": false,
"allow_disconnected_create": false,
"background_update_interval": 3
}
Run by
cargo run -- -c /path/to/config.json
Instance B:
{
"my_address": "127.0.0.1:7772",
"peers": {
"pandora": "http://127.0.0.1:7771"
},
"mount_point": "/Users/yuan/p/cse223/monovault/mount2",
"db_path": "/Users/yuan/p/cse223/monovault/db2",
"local_vault_name": "moon",
"caching": false,
"share_local_vault": true,
"allow_disconnected_delete": false,
"allow_disconnected_create": false,
"background_update_interval": 3
}
cargo run -- -c /path/to/config2.json
If caching is enabled, the filesystem downloads the file from remote when opening the file and reads and writes to the local copy, only resyncing to the remote when closing the file. To enable cache, set "caching" to true.