sshfs-offline 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sshfs_offline-0.0.1/LICENSE +21 -0
- sshfs_offline-0.0.1/PKG-INFO +161 -0
- sshfs_offline-0.0.1/README.md +136 -0
- sshfs_offline-0.0.1/pyproject.toml +42 -0
- sshfs_offline-0.0.1/setup.cfg +4 -0
- sshfs_offline-0.0.1/src/sshfs-offline/__init__.py +0 -0
- sshfs_offline-0.0.1/src/sshfs-offline/cli.py +340 -0
- sshfs_offline-0.0.1/src/sshfs-offline/data.py +166 -0
- sshfs_offline-0.0.1/src/sshfs-offline/log.py +49 -0
- sshfs_offline-0.0.1/src/sshfs-offline/metadata.py +166 -0
- sshfs_offline-0.0.1/src/sshfs-offline/metrics.py +64 -0
- sshfs_offline-0.0.1/src/sshfs-offline/sftp.py +188 -0
- sshfs_offline-0.0.1/src/sshfs_offline.egg-info/PKG-INFO +161 -0
- sshfs_offline-0.0.1/src/sshfs_offline.egg-info/SOURCES.txt +15 -0
- sshfs_offline-0.0.1/src/sshfs_offline.egg-info/dependency_links.txt +1 -0
- sshfs_offline-0.0.1/src/sshfs_offline.egg-info/entry_points.txt +2 -0
- sshfs_offline-0.0.1/src/sshfs_offline.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 David Christenson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sshfs-offline
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: SSH File System with offline access to cached files.
|
|
5
|
+
Author-email: Dave Christenson <davechri58@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: offline,cache,sshfs,fuse-filesystem,fuse
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Topic :: System :: Filesystems
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.4
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
21
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
sshfs-offline
|
|
27
|
+
=============
|
|
28
|
+
|
|
29
|
+
SSH File System with offline access to cached files.
|
|
30
|
+
|
|
31
|
+
Features:
|
|
32
|
+
|
|
33
|
+
- Based on FUSE (Filesystem in Userspace framework for Linux)
|
|
34
|
+
|
|
35
|
+
- Metadata and Data are cached locally to improve performance.
|
|
36
|
+
|
|
37
|
+
- Offline access to cached data when the remote host is not reachable
|
|
38
|
+
|
|
39
|
+
- Read/Write file system
|
|
40
|
+
|
|
41
|
+
Install Script:
|
|
42
|
+
===============
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
$ pip install sshfs-offline
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
How to mount a filesystem
|
|
50
|
+
=========================
|
|
51
|
+
|
|
52
|
+
Usage:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
usage: sshfs-offline [-h] [-p PORT] [-u USER] [-d REMOTEDIR] [--debug] [--cachetimeout CACHETIMEOUT] host mountpoint
|
|
56
|
+
|
|
57
|
+
To unmount use: fusermount -u mountpoint
|
|
58
|
+
|
|
59
|
+
positional arguments:
|
|
60
|
+
host remote host name
|
|
61
|
+
mountpoint local mount point (eg, ~/mnt)
|
|
62
|
+
|
|
63
|
+
options:
|
|
64
|
+
-h, --help show this help message and exit
|
|
65
|
+
-p PORT, --port PORT port number (default=22)
|
|
66
|
+
-u USER, --user USER user on remote host
|
|
67
|
+
-d REMOTEDIR, --remotedir REMOTEDIR
|
|
68
|
+
directory on remote host (eg, ~/)
|
|
69
|
+
--debug run in debug mode
|
|
70
|
+
--cachetimeout CACHETIMEOUT
|
|
71
|
+
duration in seconds to keep metadata cached (default is 5 minutes)
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Example:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
sshfs-offline localhost ~/mnt
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Note, that it's recommended to run it as user, not as root. For this
|
|
82
|
+
to work the mountpoint must be owned by the user. If the username is
|
|
83
|
+
different on the host you are connecting to, then use the --user option.
|
|
84
|
+
|
|
85
|
+
If you need to enter a password sshfs-offline will ask for it.
|
|
86
|
+
You can also specify a remote directory using --remotedir. The default
|
|
87
|
+
is your home directory.
|
|
88
|
+
|
|
89
|
+
The cache timeout defaults to 5 minutes, and can be set with the -cachetimeout option.
|
|
90
|
+
|
|
91
|
+
To unmount the filesystem:
|
|
92
|
+
|
|
93
|
+
fusermount -u mountpoint
|
|
94
|
+
|
|
95
|
+
Cache Implementation
|
|
96
|
+
====================
|
|
97
|
+
|
|
98
|
+
The data and metadata are cached in the **.sshfs-offline** directory. In this example, the **test/myfile.txt** file has two 132K blocks. The data is cached in the **data** sub-directory, and the metadata is cached in the **metadata** sub-directory.
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
➜ .sshfs-offline
|
|
102
|
+
├── data
|
|
103
|
+
│ └── localhost # host name
|
|
104
|
+
│ └── home
|
|
105
|
+
│ └── dave
|
|
106
|
+
│ └── test
|
|
107
|
+
│ └── myfile.txt
|
|
108
|
+
└── metadata
|
|
109
|
+
└── localhost # host name
|
|
110
|
+
└── home
|
|
111
|
+
└── user
|
|
112
|
+
├── %test # test direcotry
|
|
113
|
+
│ ├── getattr # lstat status for directory
|
|
114
|
+
│ └── readdir # directory entries
|
|
115
|
+
└── %test%myfile.txt # test/myfile.txt file
|
|
116
|
+
├── blockmap # track blocks that are cached
|
|
117
|
+
└── getattr # lstat status for file
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Debugging
|
|
121
|
+
=========
|
|
122
|
+
|
|
123
|
+
* Metrics are logged to the **~/.sshfs-offline/metrics.log** file.
|
|
124
|
+
* In production (--debug=False), the log level is set to **warning**, and logs are writtend to the **~/.sshfs-offline/error.log** file.
|
|
125
|
+
* If the --debug option is specified, the log level is set to **debug**, the process is run in the foreground, and logs are written to stdout.
|
|
126
|
+
|
|
127
|
+
Using the tail command to follow the metrics:
|
|
128
|
+
```sh
|
|
129
|
+
$ tail -f ~/.sshfs-offline
|
|
130
|
+
2025-09-23 07:26:19,237:INFO:metrics
|
|
131
|
+
getattr : 181
|
|
132
|
+
getattr_hit : 181
|
|
133
|
+
init : 1
|
|
134
|
+
readdir : 26
|
|
135
|
+
readdir_hit : 26
|
|
136
|
+
readlink : 104
|
|
137
|
+
readlink_hit : 104
|
|
138
|
+
sftp_chdir : 1
|
|
139
|
+
sftp_connected : 1
|
|
140
|
+
sftp_healthThread: 1
|
|
141
|
+
sftp_start : 1
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Development
|
|
145
|
+
===========
|
|
146
|
+
|
|
147
|
+
Create Virtual Environment:
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
$ python3 -m venv my-venv-name
|
|
151
|
+
$ source ~/my-venv-name/bin/activate
|
|
152
|
+
$ pip install -r requirements.txt
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Mount filesystem:
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
$ ./sshfs-offline/cli.py localhost ~/mnt
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
sshfs-offline
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
SSH File System with offline access to cached files.
|
|
5
|
+
|
|
6
|
+
Features:
|
|
7
|
+
|
|
8
|
+
- Based on FUSE (Filesystem in Userspace framework for Linux)
|
|
9
|
+
|
|
10
|
+
- Metadata and Data are cached locally to improve performance.
|
|
11
|
+
|
|
12
|
+
- Offline access to cached data when the remote host is not reachable
|
|
13
|
+
|
|
14
|
+
- Read/Write file system
|
|
15
|
+
|
|
16
|
+
Install Script:
|
|
17
|
+
===============
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
$ pip install sshfs-offline
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
How to mount a filesystem
|
|
25
|
+
=========================
|
|
26
|
+
|
|
27
|
+
Usage:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
usage: sshfs-offline [-h] [-p PORT] [-u USER] [-d REMOTEDIR] [--debug] [--cachetimeout CACHETIMEOUT] host mountpoint
|
|
31
|
+
|
|
32
|
+
To unmount use: fusermount -u mountpoint
|
|
33
|
+
|
|
34
|
+
positional arguments:
|
|
35
|
+
host remote host name
|
|
36
|
+
mountpoint local mount point (eg, ~/mnt)
|
|
37
|
+
|
|
38
|
+
options:
|
|
39
|
+
-h, --help show this help message and exit
|
|
40
|
+
-p PORT, --port PORT port number (default=22)
|
|
41
|
+
-u USER, --user USER user on remote host
|
|
42
|
+
-d REMOTEDIR, --remotedir REMOTEDIR
|
|
43
|
+
directory on remote host (eg, ~/)
|
|
44
|
+
--debug run in debug mode
|
|
45
|
+
--cachetimeout CACHETIMEOUT
|
|
46
|
+
duration in seconds to keep metadata cached (default is 5 minutes)
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Example:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
sshfs-offline localhost ~/mnt
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Note, that it's recommended to run it as user, not as root. For this
|
|
57
|
+
to work the mountpoint must be owned by the user. If the username is
|
|
58
|
+
different on the host you are connecting to, then use the --user option.
|
|
59
|
+
|
|
60
|
+
If you need to enter a password sshfs-offline will ask for it.
|
|
61
|
+
You can also specify a remote directory using --remotedir. The default
|
|
62
|
+
is your home directory.
|
|
63
|
+
|
|
64
|
+
The cache timeout defaults to 5 minutes, and can be set with the -cachetimeout option.
|
|
65
|
+
|
|
66
|
+
To unmount the filesystem:
|
|
67
|
+
|
|
68
|
+
fusermount -u mountpoint
|
|
69
|
+
|
|
70
|
+
Cache Implementation
|
|
71
|
+
====================
|
|
72
|
+
|
|
73
|
+
The data and metadata are cached in the **.sshfs-offline** directory. In this example, the **test/myfile.txt** file has two 132K blocks. The data is cached in the **data** sub-directory, and the metadata is cached in the **metadata** sub-directory.
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
➜ .sshfs-offline
|
|
77
|
+
├── data
|
|
78
|
+
│ └── localhost # host name
|
|
79
|
+
│ └── home
|
|
80
|
+
│ └── dave
|
|
81
|
+
│ └── test
|
|
82
|
+
│ └── myfile.txt
|
|
83
|
+
└── metadata
|
|
84
|
+
└── localhost # host name
|
|
85
|
+
└── home
|
|
86
|
+
└── user
|
|
87
|
+
├── %test # test direcotry
|
|
88
|
+
│ ├── getattr # lstat status for directory
|
|
89
|
+
│ └── readdir # directory entries
|
|
90
|
+
└── %test%myfile.txt # test/myfile.txt file
|
|
91
|
+
├── blockmap # track blocks that are cached
|
|
92
|
+
└── getattr # lstat status for file
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Debugging
|
|
96
|
+
=========
|
|
97
|
+
|
|
98
|
+
* Metrics are logged to the **~/.sshfs-offline/metrics.log** file.
|
|
99
|
+
* In production (--debug=False), the log level is set to **warning**, and logs are writtend to the **~/.sshfs-offline/error.log** file.
|
|
100
|
+
* If the --debug option is specified, the log level is set to **debug**, the process is run in the foreground, and logs are written to stdout.
|
|
101
|
+
|
|
102
|
+
Using the tail command to follow the metrics:
|
|
103
|
+
```sh
|
|
104
|
+
$ tail -f ~/.sshfs-offline
|
|
105
|
+
2025-09-23 07:26:19,237:INFO:metrics
|
|
106
|
+
getattr : 181
|
|
107
|
+
getattr_hit : 181
|
|
108
|
+
init : 1
|
|
109
|
+
readdir : 26
|
|
110
|
+
readdir_hit : 26
|
|
111
|
+
readlink : 104
|
|
112
|
+
readlink_hit : 104
|
|
113
|
+
sftp_chdir : 1
|
|
114
|
+
sftp_connected : 1
|
|
115
|
+
sftp_healthThread: 1
|
|
116
|
+
sftp_start : 1
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Development
|
|
120
|
+
===========
|
|
121
|
+
|
|
122
|
+
Create Virtual Environment:
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
$ python3 -m venv my-venv-name
|
|
126
|
+
$ source ~/my-venv-name/bin/activate
|
|
127
|
+
$ pip install -r requirements.txt
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Mount filesystem:
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
$ ./sshfs-offline/cli.py localhost ~/mnt
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[tool.setuptools.dynamic]
|
|
6
|
+
dependencies = {file = ["requirements.txt", "requirements-swh.txt"]}
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "sshfs-offline"
|
|
10
|
+
version = "0.0.1"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name="Dave Christenson", email="davechri58@gmail.com" }
|
|
14
|
+
]
|
|
15
|
+
description = "SSH File System with offline access to cached files."
|
|
16
|
+
readme = "README.md"
|
|
17
|
+
keywords = ["offline", "cache", "sshfs", "fuse-filesystem", "fuse"]
|
|
18
|
+
classifiers = [
|
|
19
|
+
# How mature is this project? Common values are
|
|
20
|
+
# 3 - Alpha
|
|
21
|
+
# 4 - Beta
|
|
22
|
+
# 5 - Production/Stable
|
|
23
|
+
"Development Status :: 4 - Beta",
|
|
24
|
+
|
|
25
|
+
# Indicate who your project is intended for
|
|
26
|
+
"Topic :: System :: Filesystems",
|
|
27
|
+
"Development Status :: 4 - Beta",
|
|
28
|
+
"Intended Audience :: Developers",
|
|
29
|
+
"Intended Audience :: End Users/Desktop",
|
|
30
|
+
"Operating System :: MacOS :: MacOS X",
|
|
31
|
+
"Operating System :: POSIX :: Linux",
|
|
32
|
+
"Programming Language :: Python",
|
|
33
|
+
"Programming Language :: Python :: 2.7",
|
|
34
|
+
"Programming Language :: Python :: 3.3",
|
|
35
|
+
"Programming Language :: Python :: 3.4",
|
|
36
|
+
"Programming Language :: Python :: 3.5",
|
|
37
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
38
|
+
"License :: OSI Approved :: MIT License",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
sshfs-offline = "sshfs_offline.cli:main"
|
|
File without changes
|