Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
250ce7d9
Commit
250ce7d9
authored
Mar 08, 2011
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename TahoeFS => TahoeLAFS for consistency with upstream project naming
parent
d1cdcd50
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
31 deletions
+31
-31
fs/contrib/tahoelafs/__init__.py
+20
-20
fs/contrib/tahoelafs/connection.py
+0
-0
fs/contrib/tahoelafs/test_tahoelafs.py
+7
-7
fs/contrib/tahoelafs/util.py
+0
-0
fs/opener.py
+3
-3
fs/wrapfs/debugfs.py
+1
-1
No files found.
fs/contrib/tahoefs/__init__.py
→
fs/contrib/tahoe
la
fs/__init__.py
View file @
250ce7d9
'''
fs.contrib.tahoefs
==================
fs.contrib.tahoe
la
fs
==================
==
Example (it will use publicly available, but slow-as-hell Tahoe-LAFS cloud)::
from fs.contrib.tahoe
fs import Tahoe
FS, Connection
dircap = TahoeFS.createdircap(webapi='http://pubgrid.tahoe-lafs.org')
from fs.contrib.tahoe
lafs import TahoeLA
FS, Connection
dircap = Tahoe
LA
FS.createdircap(webapi='http://pubgrid.tahoe-lafs.org')
print "Your dircap (unique key to your storage directory) is", dircap
print "Keep it safe!"
fs = TahoeFS(dircap, autorun=False, timeout=300, webapi='http://pubgrid.tahoe-lafs.org')
fs = Tahoe
LA
FS(dircap, autorun=False, timeout=300, webapi='http://pubgrid.tahoe-lafs.org')
f = fs.open("foo.txt", "a")
f.write('bar!')
f.close()
...
...
@@ -21,7 +21,7 @@ When any problem occurred, you can turn on internal debugging messages::
l.setLevel(logging.DEBUG)
l.addHandler(logging.StreamHandler(sys.stdout))
... your Python code using TahoeFS ...
... your Python code using Tahoe
LA
FS ...
TODO:
...
...
@@ -39,7 +39,7 @@ TODO:
* python3 support
* remove creating blank files (depends on FileUploadManager)
TODO (Not TahoeFS specific tasks):
TODO (Not Tahoe
LA
FS specific tasks):
* RemoteFileBuffer on the fly buffering support
* RemoteFileBuffer unit tests
* RemoteFileBuffer submit to trunk
...
...
@@ -64,7 +64,7 @@ from fs.base import fnmatch, NoDefaultMeta
from
util
import
TahoeUtil
from
connection
import
Connection
logger
=
fs
.
getLogger
(
'fs.tahoefs'
)
logger
=
fs
.
getLogger
(
'fs.tahoe
la
fs'
)
def
_fix_path
(
func
):
"""Method decorator for automatically normalising paths."""
...
...
@@ -82,12 +82,12 @@ def _fixpath(path):
class
_TahoeFS
(
FS
):
"""FS providing raw access to a Tahoe Filesystem.
class
_Tahoe
LA
FS
(
FS
):
"""FS providing raw access to a Tahoe
-LAFS
Filesystem.
This class implements all the details of interacting with a Tahoe-backed
filesystem, but you probably don't want to use it in practice. Use the
TahoeFS class instead, which has some internal caching to improve
Tahoe
LA
FS class instead, which has some internal caching to improve
performance.
"""
...
...
@@ -100,7 +100,7 @@ class _TahoeFS(FS):
def
__init__
(
self
,
dircap
,
largefilesize
=
10
*
1024
*
1024
,
webapi
=
'http://127.0.0.1:3456'
):
'''Creates instance of TahoeFS.
'''Creates instance of Tahoe
LA
FS.
:param dircap: special hash allowing user to work with TahoeLAFS directory.
:param largefilesize: - Create placeholder file for files larger than this treshold.
...
...
@@ -112,10 +112,10 @@ class _TahoeFS(FS):
self
.
largefilesize
=
largefilesize
self
.
connection
=
Connection
(
webapi
)
self
.
tahoeutil
=
TahoeUtil
(
webapi
)
super
(
_TahoeFS
,
self
)
.
__init__
(
thread_synchronize
=
_thread_synchronize_default
)
super
(
_Tahoe
LA
FS
,
self
)
.
__init__
(
thread_synchronize
=
_thread_synchronize_default
)
def
__str__
(
self
):
return
"<TahoeFS:
%
s>"
%
self
.
dircap
return
"<Tahoe
LA
FS:
%
s>"
%
self
.
dircap
@classmethod
def
createdircap
(
cls
,
webapi
=
'http://127.0.0.1:3456'
):
...
...
@@ -124,7 +124,7 @@ class _TahoeFS(FS):
def
getmeta
(
self
,
meta_name
,
default
=
NoDefaultMeta
):
if
meta_name
==
"read_only"
:
return
self
.
dircap
.
startswith
(
'URI:DIR2-RO'
)
return
super
(
_TahoeFS
,
self
)
.
getmeta
(
meta_name
,
default
)
return
super
(
_Tahoe
LA
FS
,
self
)
.
getmeta
(
meta_name
,
default
)
@_fix_path
def
open
(
self
,
path
,
mode
=
'r'
,
**
kwargs
):
...
...
@@ -317,14 +317,14 @@ class _TahoeFS(FS):
if
self
.
getmeta
(
"read_only"
):
raise
errors
.
UnsupportedError
(
'read only filesystem'
)
# FIXME: this is out of date; how to do native tahoe copy?
# FIXME: Workaround because isfile() not exists on _TahoeFS
# FIXME: Workaround because isfile() not exists on _Tahoe
LA
FS
FS
.
copy
(
self
,
src
,
dst
,
overwrite
,
chunk_size
)
def
copydir
(
self
,
src
,
dst
,
overwrite
=
False
,
ignore_errors
=
False
,
chunk_size
=
16384
):
if
self
.
getmeta
(
"read_only"
):
raise
errors
.
UnsupportedError
(
'read only filesystem'
)
# FIXME: this is out of date; how to do native tahoe copy?
# FIXME: Workaround because isfile() not exists on _TahoeFS
# FIXME: Workaround because isfile() not exists on _Tahoe
LA
FS
FS
.
copydir
(
self
,
src
,
dst
,
overwrite
,
ignore_errors
,
chunk_size
)
...
...
@@ -369,7 +369,7 @@ class _TahoeFS(FS):
if
size
>
self
.
largefilesize
:
self
.
connection
.
put
(
u'/uri/
%
s
%
s'
%
(
self
.
dircap
,
path
),
"PyFilesystem.TahoeFS: Upload started, final size
%
d"
%
size
)
"PyFilesystem.Tahoe
LA
FS: Upload started, final size
%
d"
%
size
)
self
.
connection
.
put
(
u'/uri/
%
s
%
s'
%
(
self
.
dircap
,
path
),
file
,
size
=
size
)
...
...
@@ -389,7 +389,7 @@ class _TahoeFS(FS):
class
Tahoe
FS
(
CacheFSMixin
,
_Tahoe
FS
):
class
Tahoe
LAFS
(
CacheFSMixin
,
_TahoeLA
FS
):
"""FS providing cached access to a Tahoe Filesystem.
This class is the preferred means to access a Tahoe filesystem. It
...
...
@@ -399,6 +399,6 @@ class TahoeFS(CacheFSMixin,_TahoeFS):
def
__init__
(
self
,
*
args
,
**
kwds
):
kwds
.
setdefault
(
"cache_timeout"
,
60
)
super
(
TahoeFS
,
self
)
.
__init__
(
*
args
,
**
kwds
)
super
(
Tahoe
LA
FS
,
self
)
.
__init__
(
*
args
,
**
kwds
)
fs/contrib/tahoefs/connection.py
→
fs/contrib/tahoe
la
fs/connection.py
View file @
250ce7d9
File moved
fs/contrib/tahoe
fs/test_tahoe
fs.py
→
fs/contrib/tahoe
lafs/test_tahoela
fs.py
View file @
250ce7d9
#!/usr/bin/python
"""
Test the TahoeFS
Test the Tahoe
LA
FS
@author: Marek Palatinus <marek@palatinus.cz>
"""
...
...
@@ -12,21 +12,21 @@ import unittest
from
fs.base
import
FS
import
fs.errors
as
errors
from
fs.tests
import
FSTestCases
,
ThreadingTestCases
from
fs.contrib.tahoefs
import
TahoeFS
,
Connection
from
fs.contrib.tahoefs
import
Tahoe
LA
FS
,
Connection
logging
.
getLogger
()
.
setLevel
(
logging
.
DEBUG
)
logging
.
getLogger
(
'fs.tahoefs'
)
.
addHandler
(
logging
.
StreamHandler
(
sys
.
stdout
))
WEBAPI
=
'http://pubgrid.tahoe-lafs.org'
class
TestTahoeFS
(
unittest
.
TestCase
,
FSTestCases
,
ThreadingTestCases
):
class
TestTahoe
LA
FS
(
unittest
.
TestCase
,
FSTestCases
,
ThreadingTestCases
):
# Disabled by default because it takes a *really* long time.
__test__
=
False
def
setUp
(
self
):
self
.
dircap
=
TahoeFS
.
createdircap
(
WEBAPI
)
self
.
fs
=
TahoeFS
(
self
.
dircap
,
timeout
=
0
,
webapi
=
WEBAPI
)
self
.
dircap
=
Tahoe
LA
FS
.
createdircap
(
WEBAPI
)
self
.
fs
=
Tahoe
LA
FS
(
self
.
dircap
,
timeout
=
0
,
webapi
=
WEBAPI
)
def
tearDown
(
self
):
self
.
fs
.
close
()
...
...
@@ -36,11 +36,11 @@ class TestTahoeFS(unittest.TestCase,FSTestCases,ThreadingTestCases):
self
.
assert_
(
self
.
dircap
.
startswith
(
'URI:DIR2:'
)
and
len
(
self
.
dircap
)
>
50
)
def
test_concurrent_copydir
(
self
):
# makedir() on TahoeFS is currently not atomic
# makedir() on Tahoe
LA
FS is currently not atomic
pass
def
test_makedir_winner
(
self
):
# makedir() on TahoeFS is currently not atomic
# makedir() on Tahoe
LA
FS is currently not atomic
pass
def
test_big_file
(
self
):
...
...
fs/contrib/tahoefs/util.py
→
fs/contrib/tahoe
la
fs/util.py
View file @
250ce7d9
File moved
fs/opener.py
View file @
250ce7d9
...
...
@@ -571,17 +571,17 @@ class TahoeOpener(Opener):
@classmethod
def
get_fs
(
cls
,
registry
,
fs_name
,
fs_name_params
,
fs_path
,
writeable
,
create_dir
):
from
fs.contrib.tahoefs
import
TahoeFS
from
fs.contrib.tahoefs
import
Tahoe
LA
FS
if
'/uri/'
not
in
fs_path
:
raise
OpenerError
(
"""Tahoe url should be in the form <url>/uri/<dicap>"""
)
raise
OpenerError
(
"""Tahoe
-LAFS
url should be in the form <url>/uri/<dicap>"""
)
url
,
dircap
=
fs_path
.
split
(
'/uri/'
)
path
=
''
if
'/'
in
dircap
:
dircap
,
path
=
dircap
.
split
(
'/'
,
1
)
fs
=
TahoeFS
(
dircap
,
webapi
=
url
)
fs
=
Tahoe
LA
FS
(
dircap
,
webapi
=
url
)
if
'/'
in
path
:
dirname
,
_resourcename
=
pathsplit
(
path
)
...
...
fs/wrapfs/debugfs.py
View file @
250ce7d9
...
...
@@ -4,7 +4,7 @@
DebugFS is a wrapper around filesystems to help developers
debug their work. I wrote this class mainly for debugging
Tahoe
FS and for fine tuning Tahoe
FS over Dokan with higher-level
Tahoe
LAFS and for fine tuning TahoeLA
FS over Dokan with higher-level
aplications like Total Comander, Winamp etc. Did you know
that Total Commander need to open file before it delete them? :-)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment