Statistics
| Branch: | Tag: | Revision:

root / docs / examplesdir / updownload.rst @ 1c366ac9

History | View | Annotate | Download (3.9 kB)

1 efae4212 Stavros Sachtouris
Upload and Downloads
2 efae4212 Stavros Sachtouris
====================
3 efae4212 Stavros Sachtouris
4 1c366ac9 Stavros Sachtouris
The operations of uploading files to Pithos+ as objects, and downloading
5 1c366ac9 Stavros Sachtouris
objects from Pithos+ as files are presented in this section.
6 efae4212 Stavros Sachtouris
7 efae4212 Stavros Sachtouris
Upload a file or a directory
8 efae4212 Stavros Sachtouris
----------------------------
9 efae4212 Stavros Sachtouris
10 efae4212 Stavros Sachtouris
First, check the files at the current directory
11 efae4212 Stavros Sachtouris
12 efae4212 Stavros Sachtouris
.. code-block:: console
13 efae4212 Stavros Sachtouris
14 1c366ac9 Stavros Sachtouris
    $ ls -F
15 efae4212 Stavros Sachtouris
    file2upload.txt
16 efae4212 Stavros Sachtouris
    dir2upload/
17 1c366ac9 Stavros Sachtouris
    $ kamaki container list
18 efae4212 Stavros Sachtouris
    pithos (36MB, 5 objects)
19 efae4212 Stavros Sachtouris
    trash  (0B, 0 objects)
20 efae4212 Stavros Sachtouris
21 1c366ac9 Stavros Sachtouris
Upload `file2upload.txt` to the default container (`pithos`)
22 efae4212 Stavros Sachtouris
23 efae4212 Stavros Sachtouris
.. code-block:: console
24 efae4212 Stavros Sachtouris
25 1c366ac9 Stavros Sachtouris
    $ kamaki file upload file2upload.txt
26 1c366ac9 Stavros Sachtouris
    Uploading /home/someuser/file2upload.txt --> /pithos/file2upload.txt
27 efae4212 Stavros Sachtouris
    Done
28 efae4212 Stavros Sachtouris
29 1c366ac9 Stavros Sachtouris
Confirm
30 efae4212 Stavros Sachtouris
31 efae4212 Stavros Sachtouris
.. code-block:: console
32 efae4212 Stavros Sachtouris
33 1c366ac9 Stavros Sachtouris
    $ kamaki file list
34 efae4212 Stavros Sachtouris
    2 KB file2upload.txt
35 efae4212 Stavros Sachtouris
    2KB  info.txt
36 efae4212 Stavros Sachtouris
    D    video/
37 efae4212 Stavros Sachtouris
    11MB video/tk1.mpg
38 efae4212 Stavros Sachtouris
    12MB video/tk2.mpg
39 efae4212 Stavros Sachtouris
    13MB video/tk3.mpg
40 efae4212 Stavros Sachtouris
41 efae4212 Stavros Sachtouris
Attempt to upload a whole directory, fail and retry with correct arguments
42 efae4212 Stavros Sachtouris
43 efae4212 Stavros Sachtouris
.. code-block:: console
44 efae4212 Stavros Sachtouris
45 1c366ac9 Stavros Sachtouris
    $ kamaki file upload dir2upload
46 efae4212 Stavros Sachtouris
    /home/someuser/dir2upload is a directory
47 1c366ac9 Stavros Sachtouris
    |  Use -r to upload directory contents
48 1c366ac9 Stavros Sachtouris
    $ kamaki file upload -r dir2upload
49 1c366ac9 Stavros Sachtouris
    mkdir /pithos/dir2upload
50 1c366ac9 Stavros Sachtouris
    Uploading /home/someuser/dir2upload/large.mov --> /pithos/dir2upload/large.mov
51 1c366ac9 Stavros Sachtouris
    Uploading /home/someuser/dir2upload/small.mov --> /pithos/dir2upload/small.mov
52 efae4212 Stavros Sachtouris
    Done
53 1c366ac9 Stavros Sachtouris
    $ kamaki file list
54 efae4212 Stavros Sachtouris
    D    dir2upload/
55 efae4212 Stavros Sachtouris
    1GB  dir2upload/large.mov
56 efae4212 Stavros Sachtouris
    1MB  dir2upload/small.mov
57 efae4212 Stavros Sachtouris
    2 KB file2upload.txt
58 efae4212 Stavros Sachtouris
    2KB  info.txt
59 efae4212 Stavros Sachtouris
    D    video/
60 efae4212 Stavros Sachtouris
    11MB video/tk1.mpg
61 efae4212 Stavros Sachtouris
    12MB video/tk2.mpg
62 efae4212 Stavros Sachtouris
    13MB video/tk3.mpg
63 efae4212 Stavros Sachtouris
64 1c366ac9 Stavros Sachtouris
.. note:: Try to re-upload the files (use the -f option to override) and notice
65 1c366ac9 Stavros Sachtouris
    how much faster is the uploading now. Pithos+ can determine what parts
66 1c366ac9 Stavros Sachtouris
    (blocks) of the file are already uploaded so that only the missing pars
67 1c366ac9 Stavros Sachtouris
    will be uploaded.
68 efae4212 Stavros Sachtouris
69 efae4212 Stavros Sachtouris
Download an object or a directory
70 efae4212 Stavros Sachtouris
---------------------------------
71 efae4212 Stavros Sachtouris
72 efae4212 Stavros Sachtouris
Download object `info.txt` as a local file of the same name
73 efae4212 Stavros Sachtouris
74 efae4212 Stavros Sachtouris
.. code-block:: console
75 efae4212 Stavros Sachtouris
76 1c366ac9 Stavros Sachtouris
    $ kamaki file download info.txt
77 1c366ac9 Stavros Sachtouris
    Downloading /pithos/info.txt --> /home/someuser/info.txt
78 1c366ac9 Stavros Sachtouris
    Done
79 efae4212 Stavros Sachtouris
80 efae4212 Stavros Sachtouris
Download directory `video` as a local directory with its contents.
81 1c366ac9 Stavros Sachtouris
We assume that a power failure causes the operation to stop unexpectingly
82 efae4212 Stavros Sachtouris
before it's completed.
83 efae4212 Stavros Sachtouris
84 efae4212 Stavros Sachtouris
.. code-block:: console
85 efae4212 Stavros Sachtouris
86 1c366ac9 Stavros Sachtouris
    $ kamaki file download -R /pithos/video
87 efae4212 Stavros Sachtouris
    mkdir video
88 1c366ac9 Stavros Sachtouris
    Downloading /pithos/video/tk1.mpg --> /home/someuser/video/tk1.mpg
89 efae4212 Stavros Sachtouris
    Done
90 1c366ac9 Stavros Sachtouris
    Downloading /pithos/video/tk2.mpg --> /home/someuser/video/tk2.mpg
91 efae4212 Stavros Sachtouris
    <POWER FAILURE>
92 efae4212 Stavros Sachtouris
93 1c366ac9 Stavros Sachtouris
After we recover the terminal , we find out that `tk1.mpg` had been downloaded
94 1c366ac9 Stavros Sachtouris
while `tk2.mpg` download is incomplete.
95 efae4212 Stavros Sachtouris
96 efae4212 Stavros Sachtouris
.. code-block:: console
97 efae4212 Stavros Sachtouris
98 efae4212 Stavros Sachtouris
    $ ls -F video
99 efae4212 Stavros Sachtouris
    tk1.mpg 11MB
100 efae4212 Stavros Sachtouris
    tk2.mpg 4MB
101 efae4212 Stavros Sachtouris
102 1c366ac9 Stavros Sachtouris
Resume the download (use -f)
103 efae4212 Stavros Sachtouris
104 efae4212 Stavros Sachtouris
.. code-block:: console
105 efae4212 Stavros Sachtouris
106 1c366ac9 Stavros Sachtouris
    $ kamaki file download -r -f /pithos/video
107 1c366ac9 Stavros Sachtouris
    Resuming /pithos/video/tk2.mpg --> /home/someuser/video/tk2.mpg
108 1c366ac9 Stavros Sachtouris
    Downloading /pithos/video/tk3.mpg --> /home/someuser/video/tk3.mpg
109 efae4212 Stavros Sachtouris
    Done
110 1c366ac9 Stavros Sachtouris
111 1c366ac9 Stavros Sachtouris
.. note:: The -f/--force argument is used for resuming or overwriting a file.
112 1c366ac9 Stavros Sachtouris
    The result of using the argument is always the same: the local file will be
113 1c366ac9 Stavros Sachtouris
    the same as the remote one.
114 efae4212 Stavros Sachtouris
115 efae4212 Stavros Sachtouris
Upload all
116 efae4212 Stavros Sachtouris
----------
117 efae4212 Stavros Sachtouris
118 efae4212 Stavros Sachtouris
.. code-block:: console
119 efae4212 Stavros Sachtouris
120 1c366ac9 Stavros Sachtouris
    $ kamaki file upload -r -f . /pithos
121 efae4212 Stavros Sachtouris
    Done
122 efae4212 Stavros Sachtouris
123 f6822a26 Stavros Sachtouris
.. note:: In this case, all files were already uploaded, so kamaki didn't have
124 f6822a26 Stavros Sachtouris
    to upload anything. If a file was modified, kamaki would sync it with its
125 f6822a26 Stavros Sachtouris
    remote counterpart.
126 efae4212 Stavros Sachtouris
127 1c366ac9 Stavros Sachtouris
.. note:: The **/pithos** argument means "from container **pithos**", which is
128 1c366ac9 Stavros Sachtouris
    the default container. If a user needs to upload everything to another
129 1c366ac9 Stavros Sachtouris
    container e.g., **images**:
130 1c366ac9 Stavros Sachtouris
131 1c366ac9 Stavros Sachtouris
    .. code-block:: console
132 1c366ac9 Stavros Sachtouris
133 1c366ac9 Stavros Sachtouris
        $ kamaki file upload -r -f . /images
134 1c366ac9 Stavros Sachtouris
135 efae4212 Stavros Sachtouris
Download all
136 efae4212 Stavros Sachtouris
------------
137 efae4212 Stavros Sachtouris
138 efae4212 Stavros Sachtouris
.. code-block:: console
139 efae4212 Stavros Sachtouris
140 1c366ac9 Stavros Sachtouris
    $ kamaki file download -r -f /pithos .
141 efae4212 Stavros Sachtouris
    Done
142 efae4212 Stavros Sachtouris
143 f6822a26 Stavros Sachtouris
.. note:: Kamaki determined that all remote objects already exist as local files
144 f6822a26 Stavros Sachtouris
    too, so there is nothing to be done. If a new remote object was created or
145 f6822a26 Stavros Sachtouris
    an old one was modified, kamaki would have sync it with a local file.