|
1 |
Upload and Downloads
|
|
2 |
====================
|
|
3 |
|
|
4 |
The operations of uploading files to pithos as objects, and downloading
|
|
5 |
objects from pithos as a file are presented in this section.
|
|
6 |
|
|
7 |
Enter file context
|
|
8 |
|
|
9 |
.. code-block:: console
|
|
10 |
|
|
11 |
$ kamaki
|
|
12 |
[kamaki]: file
|
|
13 |
[file]:
|
|
14 |
|
|
15 |
Upload a file or a directory
|
|
16 |
----------------------------
|
|
17 |
|
|
18 |
First, check the files at the current directory
|
|
19 |
|
|
20 |
.. code-block:: console
|
|
21 |
|
|
22 |
[file]: ! ls -F
|
|
23 |
file2upload.txt
|
|
24 |
dir2upload/
|
|
25 |
[file]: list
|
|
26 |
pithos (36MB, 5 objects)
|
|
27 |
trash (0B, 0 objects)
|
|
28 |
|
|
29 |
.. note:: the `!` symbol is used to run host shell commands
|
|
30 |
|
|
31 |
Upload `file2upload.txt` to remote container `pithos`
|
|
32 |
|
|
33 |
.. code-block:: console
|
|
34 |
|
|
35 |
[file]: upload file2upload.txt pithos
|
|
36 |
Uploading /home/someuser/file2upload.txt --> pithos:file2upload.txt
|
|
37 |
Done
|
|
38 |
|
|
39 |
Check remote container `pithos` to confirm
|
|
40 |
|
|
41 |
.. code-block:: console
|
|
42 |
|
|
43 |
[file]: list pithos
|
|
44 |
2 KB file2upload.txt
|
|
45 |
2KB info.txt
|
|
46 |
D video/
|
|
47 |
11MB video/tk1.mpg
|
|
48 |
12MB video/tk2.mpg
|
|
49 |
13MB video/tk3.mpg
|
|
50 |
[file]:
|
|
51 |
|
|
52 |
Attempt to upload a whole directory, fail and retry with correct arguments
|
|
53 |
|
|
54 |
.. code-block:: console
|
|
55 |
|
|
56 |
[file]: upload dir2upload pithos
|
|
57 |
/home/someuser/dir2upload is a directory
|
|
58 |
| Use -R to upload directory contents
|
|
59 |
[file]: upload -R dirupload pithos
|
|
60 |
mkdir pithos:dir2upload
|
|
61 |
Uploading /home/someuser/dir2upload/large.mov --> pithos:dir2upload/large.mov
|
|
62 |
Uploading /home/someuser/dir2upload/small.mov --> pithos:dir2upload/small.mov
|
|
63 |
Done
|
|
64 |
[file]: list pithos
|
|
65 |
D dir2upload/
|
|
66 |
1GB dir2upload/large.mov
|
|
67 |
1MB dir2upload/small.mov
|
|
68 |
2 KB file2upload.txt
|
|
69 |
2KB info.txt
|
|
70 |
D video/
|
|
71 |
11MB video/tk1.mpg
|
|
72 |
12MB video/tk2.mpg
|
|
73 |
13MB video/tk3.mpg
|
|
74 |
[file]:
|
|
75 |
|
|
76 |
.. note:: Try to reupload the files (use the -f option to override) and notice
|
|
77 |
how much faster is the uploading now. Pithos can determine what parts of
|
|
78 |
the file are already uploaded so that kamaki won't attempt to upload them
|
|
79 |
again.
|
|
80 |
|
|
81 |
Download an object or a directory
|
|
82 |
---------------------------------
|
|
83 |
|
|
84 |
Download object `info.txt` as a local file of the same name
|
|
85 |
|
|
86 |
.. code-block:: console
|
|
87 |
|
|
88 |
[file]: download pithos:info.txt
|
|
89 |
Downloading pithos:info.txt --> /home/someuser/info.txt
|
|
90 |
Donw
|
|
91 |
[file]:
|
|
92 |
|
|
93 |
Download directory `video` as a local directory with its contents.
|
|
94 |
We will suppose that a power failure causes the operation to stop unexpectingly
|
|
95 |
before it's completed.
|
|
96 |
|
|
97 |
.. code-block:: console
|
|
98 |
|
|
99 |
[file]: download -R pithos:video
|
|
100 |
mkdir video
|
|
101 |
Downloading pithos:video/tk1.mpg --> /home/someuser/video/tk1.mpg
|
|
102 |
Done
|
|
103 |
Downloading pithos:video/tk2.mpg --> /home/someuser/video/tk2.mpg
|
|
104 |
<POWER FAILURE>
|
|
105 |
|
|
106 |
After we recover the terminal and load kamaki in `file` context, we find out
|
|
107 |
that `tk1.mpg` had been downloaded while `tk2.mpg` download is incomplete.
|
|
108 |
|
|
109 |
.. code-block:: console
|
|
110 |
|
|
111 |
$ ls -F video
|
|
112 |
tk1.mpg 11MB
|
|
113 |
tk2.mpg 4MB
|
|
114 |
$
|
|
115 |
|
|
116 |
Let's resume the download uperations (use -r)
|
|
117 |
|
|
118 |
.. code-block:: console
|
|
119 |
|
|
120 |
[file]: download -R pithos:video
|
|
121 |
Directory video already exists
|
|
122 |
| Use -r to resume
|
|
123 |
[file]: download -R -r pithos:video
|
|
124 |
Resuming pithos:video/tk2.mpg --> /home/someuser/video/tk2.mpg
|
|
125 |
Downloading pithos:video/tk3.mpg --> /home/someuser/video/tk3.mpg
|
|
126 |
Done
|
|
127 |
[file]:
|
|
128 |
|
|
129 |
Upload all
|
|
130 |
----------
|
|
131 |
|
|
132 |
.. code-block:: console
|
|
133 |
|
|
134 |
[file]: upload -R -f . pithos
|
|
135 |
Done
|
|
136 |
[file]:
|
|
137 |
|
|
138 |
.. note:: Kamaki calculated that all information is already uploaded, there was
|
|
139 |
nothing to be done. If there is was a new or modified file, kamaki would
|
|
140 |
detect and upload it.
|
|
141 |
|
|
142 |
Download all
|
|
143 |
------------
|
|
144 |
|
|
145 |
.. code-block:: console
|
|
146 |
|
|
147 |
[file]: download -R -r pithos
|
|
148 |
Done
|
|
149 |
[file]:
|
|
150 |
|
|
151 |
.. note:: Kamaki determined that all files have already been calculated. This
|
|
152 |
operation examines all local files against the remote objects and
|
|
153 |
downloads only missing data.
|