From 7274131052d3113e6986e34ca91b95641755786f Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Wed, 14 May 2025 12:05:13 +0200 Subject: [PATCH] update readme --- README.md | 31 ++++++++++++++++++- .../dhfs/peersync/PeerLastSeenUpdater.java | 10 +++--- run-wrapper/run.ps1 | 2 ++ run-wrapper/stop.ps1 | 2 ++ run-wrapper/update.ps1 | 2 ++ 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index db73e080..b7a031a2 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,36 @@ the DHFS server in the background, and update itself (hopefully!) ## How to use it? +### General prerequisites -Unpack the run-wrapper and run the `run` script. The filesystem should be mounted to the `fuse` folder in the run-wrapper root directory. +Java should be available as `java` in path, and Java 21+ is required. + +FUSE 2 userspace library also should be available: + +- On Ubuntu `libfuse2` package can be installed. + +- On Windows, [WinFsp](https://winfsp.dev/) should be installed. + +- On macOS, [macFUSE](https://macfuse.github.io/). + +In the run-wrapper, 3 scripts are available. + +- `run` script starts the filesystem +- `stop` script stops it +- `update` script will update the filesystem to the newest available CI build + +On Windows, Powershell alternatives should be used. For them to work, it might be required to allow execution of unsigned scripts using `set-executionpolicy remotesigned`. + +Additional options for the filesystem can be specified in the `extra-opts` file in the same directory with the run scripts. + +One line in the `extra-opts` file corresponds to one option passed to the JVM when starting the filesystem. + +Some extra possible configuration options are: + +- `-Ddhfs.fuse.root=` specifies the root where filesystem should be mounted. By default it is the `fuse` path under the `run-wrapper` root. For windows, it should be a disk letter, by default `Z:\`. +- `-Ddhfs.objects.last-seen.timeout=` specifies the period of time (in seconds) after which unavailable peers will be ignored for gabgage collection and resynchronized after being reconnected. The default is 43200 (30 days), if set to `-1`, this feature is disabled. +- `-Ddhfs.objects.autosync.download-all=` specifies whether all objects (files and their data) should be downloaded to this peer. `true` or `false`, the default is `false`. + +On Windows, the entire space for the filesystem should also be preallocated, the `-Ddhfs.objects.persistence.lmdb.size=` option controls the size (the value is in bytes), on Windows the default is 100GB. Then, a web interface will be available at `losthost:8080`, that can be used to connect with other peers. diff --git a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/peersync/PeerLastSeenUpdater.java b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/peersync/PeerLastSeenUpdater.java index ce7fa424..f7afd59d 100644 --- a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/peersync/PeerLastSeenUpdater.java +++ b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/peersync/PeerLastSeenUpdater.java @@ -52,10 +52,12 @@ public class PeerLastSeenUpdater { var curInfo = remoteTransaction.getData(PeerInfo.class, u.id()).orElse(null); if (curInfo == null) return; - var lastSeen = curInfo.lastSeenTimestamp(); - if (System.currentTimeMillis() - lastSeen > (lastSeenTimeout * 1000)) { - var kicked = curInfo.withIncrementedKickCounter(persistentPeerDataService.getSelfUuid()); - remoteTransaction.putData(kicked); + if (lastSeenTimeout != -1) { + var lastSeen = curInfo.lastSeenTimestamp(); + if (System.currentTimeMillis() - lastSeen > (lastSeenTimeout * 1000)) { + var kicked = curInfo.withIncrementedKickCounter(persistentPeerDataService.getSelfUuid()); + remoteTransaction.putData(kicked); + } } }); } diff --git a/run-wrapper/run.ps1 b/run-wrapper/run.ps1 index 8549e694..9d9bfc3e 100644 --- a/run-wrapper/run.ps1 +++ b/run-wrapper/run.ps1 @@ -1,3 +1,5 @@ +# https://chatgpt.com/c/681762a4-dddc-800a-adad-2797355013f8 + $ErrorActionPreference = 'Stop' $PIDFILE = Join-Path $PSScriptRoot ".pid" diff --git a/run-wrapper/stop.ps1 b/run-wrapper/stop.ps1 index 636c58d7..bbe18280 100644 --- a/run-wrapper/stop.ps1 +++ b/run-wrapper/stop.ps1 @@ -1,3 +1,5 @@ +# https://chatgpt.com/c/681762a4-dddc-800a-adad-2797355013f8 + $ErrorActionPreference = 'Stop' $PIDFILE = Join-Path $PSScriptRoot ".pid" diff --git a/run-wrapper/update.ps1 b/run-wrapper/update.ps1 index 597f4dc4..8c0ff8f8 100644 --- a/run-wrapper/update.ps1 +++ b/run-wrapper/update.ps1 @@ -1,3 +1,5 @@ +# https://chatgpt.com/c/681762a4-dddc-800a-adad-2797355013f8 + $ErrorActionPreference = 'Stop' $PIDFILE = Join-Path $PSScriptRoot ".pid"