[tahoe-dev] hello

Zooko Wilcox-O'Hearn zooko at zooko.com
Fri Nov 2 14:33:13 PDT 2012

On Tue, Oct 30, 2012 at 9:25 AM, han zheng <z.han0903 at gmail.com> wrote:
> Is there a way to directly upload a local file to the "tahoe cloud" not using the web server?

Tahoe-LAFS doesn't offer any API reachable from other processes
(command-line, kernel, or remote-procedure-call) which *doesn't* route
through the webapi. The diagram "network-and-reliance-toplogy.svg" 9
shows this architecture. Everything goes through the "Tahoe-LAFS
gateway", and the only API that the Tahoe-LAFS gateway exports is the

9 https://tahoe-lafs.org/trac/tahoe-lafs/browser/docs/network-and-reliance-topology.svg

Han Zheng: why do you want to upload a local file to the tahoe grid
not using the web server?

The way to accomplish that is to write some Python code that runs in
the same Python process as the Tahoe-LAFS gateway. The way that I find
easiest to do such things is to look at other code that already does
it and copy and modify that.

So, here is the code that gets run when someone makes a PUT request to
the webapi (as described in webapi.rst 2):

2 https://tahoe-lafs.org/trac/tahoe-lafs/browser/git/docs/frontends/webapi.rst?rev=05d0b8b5b9247e1d0541e58250a81df89d5c9115#writing-uploading-a-file

web/root.py parses the HTTP request and decides what sort of upload
this is (mutable or immutable):


Then it calls web/unlinked.py which constructs a FileHandle object.
That object is provides the interface that the uploader expects, and
it has a handle (open file descriptor) to the file on disk from which
it will read the data while the data is being uploaded.


Then (after an unnecessary layer of indirection that I'm skipping),
immutable/upload.py starts doing some real work: setting the encoding
parameters, deciding whether to literalize this immutable file, etc:


So, if you write some Python code that invokes immutable/upload.py's
"upload()" method, and passes an "uploadable" as the argument (note
that in case shown above the "uploadable" is the FileHandle object
constructed by web/unlinked.py), then you'll upload a file directly to
the grid.


tahoe-dev mailing list
tahoe-dev at tahoe-lafs.org

----- End forwarded message -----
Eugen* Leitl <a href="http://leitl.org">leitl</a> http://leitl.org
ICBM: 48.07100, 11.36820 http://www.ativel.com http://postbiota.org
8B29F6BE: 099D 78BA 2FD3 B014 B08A  7779 75B0 2443 8B29 F6BE

More information about the cypherpunks-legacy mailing list