1 | 1 patch for repository davidsarah@dev.allmydata.org:/home/darcs/tahoe/trunk: |
---|
2 | |
---|
3 | Thu Dec 30 04:19:09 GMT Standard Time 2010 david-sarah@jacaranda.org |
---|
4 | * Move responsibility for calculating the estimated total/used/available space on a grid as used by SFTP to client.py. refs #1285 |
---|
5 | |
---|
6 | New patches: |
---|
7 | |
---|
8 | [Move responsibility for calculating the estimated total/used/available space on a grid as used by SFTP to client.py. refs #1285 |
---|
9 | david-sarah@jacaranda.org**20101230041909 |
---|
10 | Ignore-this: 96ef30774bfc678f9890333b046f9f90 |
---|
11 | ] { |
---|
12 | hunk ./src/allmydata/client.py 476 |
---|
13 | d.addCallback(lambda res: None) |
---|
14 | return d |
---|
15 | |
---|
16 | + def get_grid_stats(self): |
---|
17 | + # Make up some values; see ticket #1285. |
---|
18 | + used_KiB = available_KiB = 314159265 |
---|
19 | + |
---|
20 | + total_KiB = used_KiB + available_KiB |
---|
21 | + used_percent = 0 |
---|
22 | + if total_KiB > 0: |
---|
23 | + used_percent = used_KiB * 100 // total_KiB |
---|
24 | + return { 'total_KiB': total_KiB, 'used_KiB': used_KiB, 'available_KiB': available_KiB, |
---|
25 | + 'used_percent': used_percent, 'fake': True} |
---|
26 | + |
---|
27 | |
---|
28 | # these four methods are the primitives for creating filenodes and |
---|
29 | # dirnodes. The first takes a URI and produces a filenode or (new-style) |
---|
30 | hunk ./src/allmydata/frontends/sftpd.py 1759 |
---|
31 | |
---|
32 | if extensionName == 'statvfs@openssh.com' or extensionName == 'fstatvfs@openssh.com': |
---|
33 | # f_bsize and f_frsize should be the same to avoid a bug in 'df' |
---|
34 | + stats = self._get_grid_stats() |
---|
35 | return defer.succeed(struct.pack('>11Q', |
---|
36 | hunk ./src/allmydata/frontends/sftpd.py 1761 |
---|
37 | - 1024, # uint64 f_bsize /* file system block size */ |
---|
38 | - 1024, # uint64 f_frsize /* fundamental fs block size */ |
---|
39 | - 628318530, # uint64 f_blocks /* number of blocks (unit f_frsize) */ |
---|
40 | - 314159265, # uint64 f_bfree /* free blocks in file system */ |
---|
41 | - 314159265, # uint64 f_bavail /* free blocks for non-root */ |
---|
42 | - 200000000, # uint64 f_files /* total file inodes */ |
---|
43 | - 100000000, # uint64 f_ffree /* free file inodes */ |
---|
44 | - 100000000, # uint64 f_favail /* free file inodes for non-root */ |
---|
45 | - 0x1AF5, # uint64 f_fsid /* file system id */ |
---|
46 | - 2, # uint64 f_flag /* bit mask = ST_NOSUID; not ST_RDONLY */ |
---|
47 | - 65535, # uint64 f_namemax /* maximum filename length */ |
---|
48 | + 1024, # uint64 f_bsize /* file system block size */ |
---|
49 | + 1024, # uint64 f_frsize /* fundamental fs block size */ |
---|
50 | + stats['total_KiB'], # uint64 f_blocks /* number of blocks (unit f_frsize) */ |
---|
51 | + stats['available_KiB'], # uint64 f_bfree /* free blocks in file system */ |
---|
52 | + stats['available_KiB'], # uint64 f_bavail /* free blocks for non-root */ |
---|
53 | + 200000000, # uint64 f_files /* total file inodes */ |
---|
54 | + 100000000, # uint64 f_ffree /* free file inodes */ |
---|
55 | + 100000000, # uint64 f_favail /* free file inodes for non-root */ |
---|
56 | + 0x1AF5, # uint64 f_fsid /* file system id */ |
---|
57 | + 2, # uint64 f_flag /* bit mask = ST_NOSUID; not ST_RDONLY */ |
---|
58 | + 65535, # uint64 f_namemax /* maximum filename length */ |
---|
59 | )) |
---|
60 | |
---|
61 | def _unsupported(): raise SFTPError(FX_OP_UNSUPPORTED, "unsupported %r request <data of length %r>" % |
---|
62 | hunk ./src/allmydata/frontends/sftpd.py 1840 |
---|
63 | d.addCallback(_got_root) |
---|
64 | return d |
---|
65 | |
---|
66 | + def _get_grid_stats(self): |
---|
67 | + return self._client.get_grid_stats() |
---|
68 | + |
---|
69 | |
---|
70 | class FakeTransport: |
---|
71 | implements(ITransport) |
---|
72 | hunk ./src/allmydata/frontends/sftpd.py 1863 |
---|
73 | def __init__(self, userHandler): |
---|
74 | PrefixingLogMixin.__init__(self, facility="tahoe.sftp") |
---|
75 | if noisy: self.log(".__init__(%r)" % (userHandler), level=NOISY) |
---|
76 | + self._userHandler = userHandler |
---|
77 | |
---|
78 | def getPty(self, terminal, windowSize, attrs): |
---|
79 | self.log(".getPty(%r, %r, %r)" % (terminal, windowSize, attrs), level=OPERATIONAL) |
---|
80 | hunk ./src/allmydata/frontends/sftpd.py 1885 |
---|
81 | |
---|
82 | d = defer.succeed(None) |
---|
83 | if cmd == "df -P -k /": |
---|
84 | + stats = self._userHandler._get_grid_stats() |
---|
85 | d.addCallback(lambda ign: protocol.write( |
---|
86 | hunk ./src/allmydata/frontends/sftpd.py 1887 |
---|
87 | - "Filesystem 1024-blocks Used Available Capacity Mounted on\n" |
---|
88 | - "tahoe 628318530 314159265 314159265 50% /\n")) |
---|
89 | + "Filesystem 1024-blocks Used Available Capacity Mounted on\n" |
---|
90 | + "tahoe %11d %11d %11d %3d /\n" |
---|
91 | + % (stats['total_KiB'], stats['used_KiB'], stats['available_KiB'], stats['used_percent']))) |
---|
92 | d.addCallback(lambda ign: protocol.processEnded(Reason(ProcessDone(None)))) |
---|
93 | else: |
---|
94 | d.addCallback(lambda ign: protocol.processEnded(Reason(ProcessTerminated(exitCode=1)))) |
---|
95 | hunk ./src/allmydata/interfaces.py 2132 |
---|
96 | DirectoryNode. |
---|
97 | """ |
---|
98 | |
---|
99 | + def get_grid_stats(): |
---|
100 | + """Get estimates of the total, used, and available space on this grid. |
---|
101 | + These estimates use an expansion factor based on the current encoding |
---|
102 | + settings, so may be inaccurate if the settings have changed. They only |
---|
103 | + take into account servers currently connected to this client. |
---|
104 | + @return: a dict with at least the following fields: |
---|
105 | + total_KiB: estimated total space on the grid, in KiB |
---|
106 | + used_KiB: estimated used space on the grid, in KiB |
---|
107 | + available_KiB: estimated available space on the grid, in KiB |
---|
108 | + used_percent: used space as a percentage (rounded) |
---|
109 | + fake: True if the values are just made up. |
---|
110 | + """ |
---|
111 | + |
---|
112 | class INodeMaker(Interface): |
---|
113 | """The NodeMaker is used to create IFilesystemNode instances. It can |
---|
114 | accept a filecap/dircap string and return the node right away. It can |
---|
115 | } |
---|
116 | |
---|
117 | Context: |
---|
118 | |
---|
119 | [docs/webapi.rst: typos. |
---|
120 | david-sarah@jacaranda.org**20101230034422 |
---|
121 | Ignore-this: d1f5166d72cc711f7e0d9981eac9105e |
---|
122 | ] |
---|
123 | [docs/webapi.rst: capitalization, formatting of section on URL character encoding, and a correction about Internet Explorer. |
---|
124 | david-sarah@jacaranda.org**20101230034049 |
---|
125 | Ignore-this: b3b9819d2fb264b4cdc5c8afd4e8c48d |
---|
126 | ] |
---|
127 | [docs: corrections and clarifications. |
---|
128 | david-sarah@jacaranda.org**20101227051056 |
---|
129 | Ignore-this: e33202858c7644c58f3f924b164294b6 |
---|
130 | ] |
---|
131 | [docs: more formatting cleanups and corrections. Spell webapi and wapi as web-API. |
---|
132 | david-sarah@jacaranda.org**20101227050533 |
---|
133 | Ignore-this: 18b23cbfb780df585d8a722a1ec63e94 |
---|
134 | ] |
---|
135 | [docs/debian.rst: bring description of building dependencies from source up-to-date, and change hostname from allmydata.com to tahoe-lafs.org. |
---|
136 | david-sarah@jacaranda.org**20101212222912 |
---|
137 | Ignore-this: f38462afc88b4475195610385a28391c |
---|
138 | ] |
---|
139 | [docs/architecture.rst: correct rst syntax. |
---|
140 | david-sarah@jacaranda.org**20101212202003 |
---|
141 | Ignore-this: 3fbe12feb28bec6f1c63aedbc79aad21 |
---|
142 | ] |
---|
143 | [docs/architecture.rst: formatting. |
---|
144 | david-sarah@jacaranda.org**20101212201719 |
---|
145 | Ignore-this: 305fa5dfc2939355eaf6d0d2161eb1ff |
---|
146 | ] |
---|
147 | [docs: linkification, wording improvements. |
---|
148 | david-sarah@jacaranda.org**20101212201234 |
---|
149 | Ignore-this: 4e67287f527a8bc728cfbd93255d2aae |
---|
150 | ] |
---|
151 | [docs: formatting. |
---|
152 | david-sarah@jacaranda.org**20101212201115 |
---|
153 | Ignore-this: 2e0ed394ac7726651d3a4f2c4b0d3798 |
---|
154 | ] |
---|
155 | [docs/configuration.rst: more formatting tweaks; which -> that. |
---|
156 | david-sarah@jacaranda.org**20101212195522 |
---|
157 | Ignore-this: a7becb7021854ca5a90edd892b36fdd7 |
---|
158 | ] |
---|
159 | [docs/configuration.rst: more changes to formatting. |
---|
160 | david-sarah@jacaranda.org**20101212194511 |
---|
161 | Ignore-this: 491aac33e5f5268d224359f1447d10be |
---|
162 | ] |
---|
163 | [docs/configuration.rst: changes to formatting (mainly putting commands and filenames in monospace). |
---|
164 | david-sarah@jacaranda.org**20101212181828 |
---|
165 | Ignore-this: 8a1480e2d5f43bee678476424615b50f |
---|
166 | ] |
---|
167 | [scripts/backupdb.py: more accurate comment about path field. |
---|
168 | david-sarah@jacaranda.org**20101212170320 |
---|
169 | Ignore-this: 50e47a2228a85207bbcd188a78a0d4e6 |
---|
170 | ] |
---|
171 | [scripts/cli.py: fix missing 'put' in usage example for 'tahoe put'. |
---|
172 | david-sarah@jacaranda.org**20101212170207 |
---|
173 | Ignore-this: 2cbadf066fff611fc03d3c0ff97ce6ec |
---|
174 | ] |
---|
175 | [docs/frontends/CLI.rst: changes to formatting (mainly putting commands and filenames in monospace), and to command syntax to reflect that DIRCAP/... is accepted. Clarify the syntax of 'tahoe put' and other minor corrections. Tahoe -> Tahoe-LAFS. |
---|
176 | david-sarah@jacaranda.org**20101212165800 |
---|
177 | Ignore-this: a123ef6b564aa8624d1e79c97068ea12 |
---|
178 | ] |
---|
179 | [docs/frontends/CLI.rst: Unicode arguments to 'tahoe' work on Windows as of v1.7.1. |
---|
180 | david-sarah@jacaranda.org**20101212063740 |
---|
181 | Ignore-this: 3977a99dfa86ac33a44171deaf43aaab |
---|
182 | ] |
---|
183 | [docs/known_issues.rst: fix title and linkify another URL. refs #1225 |
---|
184 | david-sarah@jacaranda.org**20101212062817 |
---|
185 | Ignore-this: cc91287f7fb51c23440b3d2fe79c449c |
---|
186 | ] |
---|
187 | [docs/known_issues.rst: fix an external link. refs #1225 |
---|
188 | david-sarah@jacaranda.org**20101212062435 |
---|
189 | Ignore-this: b8cbf12f353131756c358965c48060ec |
---|
190 | ] |
---|
191 | [Fix a link from uri.rst to dirnodes.rst. refs #1225 |
---|
192 | david-sarah@jacaranda.org**20101212054502 |
---|
193 | Ignore-this: af6205299f5c9a33229cab259c00f9d5 |
---|
194 | ] |
---|
195 | [Fix a link from webapi.rst to FTP-and-SFTP.rst. refs #1225 |
---|
196 | david-sarah@jacaranda.org**20101212053435 |
---|
197 | Ignore-this: 2b9f88678c3447ea860d6b61e8799858 |
---|
198 | ] |
---|
199 | [More specific hyperlink to architecture.rst from helper.rst. refs #1225 |
---|
200 | david-sarah@jacaranda.org**20101212052607 |
---|
201 | Ignore-this: 50424c768fca481252fabf58424852dc |
---|
202 | ] |
---|
203 | [Update hyperlinks between docs, and linkify some external references. refs #1225 |
---|
204 | david-sarah@jacaranda.org**20101212051459 |
---|
205 | Ignore-this: cd43a4c3d3de1f832abfa88d5fc4ace1 |
---|
206 | ] |
---|
207 | [docs/specifications/dirnodes.rst: fix references to mutable.rst. refs #1225 |
---|
208 | david-sarah@jacaranda.org**20101212012720 |
---|
209 | Ignore-this: 6819b4b4e06e947ee48b365e840db37d |
---|
210 | ] |
---|
211 | [docs/specifications/mutable.rst: correct the magic string for v1 mutable containers. refs #1225 |
---|
212 | david-sarah@jacaranda.org**20101212011400 |
---|
213 | Ignore-this: 99a5fcdd40cef83dbb08f323f6cdaaca |
---|
214 | ] |
---|
215 | [Move .txt files in docs/frontends and docs/specifications to .rst. refs #1225 |
---|
216 | david-sarah@jacaranda.org**20101212010251 |
---|
217 | Ignore-this: 8796d35d928370f7dc6ad2dafdc1c0fe |
---|
218 | ] |
---|
219 | [Convert docs/frontends and docs/specifications to reStructuredText format (not including file moves). |
---|
220 | david-sarah@jacaranda.org**20101212004632 |
---|
221 | Ignore-this: e3ceb2d832d73875abe48624ddbb5622 |
---|
222 | ] |
---|
223 | [scripts/cli.py: remove the disclaimer in the help for 'tahoe cp' that it does not handle non-ASCII filenames well. (At least, we intend to handle them.) |
---|
224 | david-sarah@jacaranda.org**20101130002145 |
---|
225 | Ignore-this: 94c003efaa20b9eb4a83503d79844ca |
---|
226 | ] |
---|
227 | [relnotes.txt: fifth -> sixth labor-of-love release |
---|
228 | zooko@zooko.com**20101129045647 |
---|
229 | Ignore-this: 21c245015268b38916e3a138d256c09d |
---|
230 | ] |
---|
231 | [Makefile: BB_BRANCH is set to the empty string for trunk, not the string 'trunk'. |
---|
232 | david-sarah@jacaranda.org**20101128233512 |
---|
233 | Ignore-this: 5a7ef8eb10475636d21b91e25b56c369 |
---|
234 | ] |
---|
235 | [relnotes.txt: eleventh -> twelfth release. |
---|
236 | david-sarah@jacaranda.org**20101128223321 |
---|
237 | Ignore-this: 1e26410156a665271c1170803dea2c0d |
---|
238 | ] |
---|
239 | [relnotes.tst: point to known_issues.rst, not known_issues.txt. |
---|
240 | david-sarah@jacaranda.org**20101128222918 |
---|
241 | Ignore-this: 60194eb4544cac446fe4f60b3e34b887 |
---|
242 | ] |
---|
243 | [quickstart.html: fix link to point to allmydata-tahoe-1.8.1.zip. |
---|
244 | david-sarah@jacaranda.org**20101128221728 |
---|
245 | Ignore-this: 7b3ee86f8256aa12f5d862f689f3ee29 |
---|
246 | ] |
---|
247 | [TAG allmydata-tahoe-1.8.1 |
---|
248 | david-sarah@jacaranda.org**20101128212336 |
---|
249 | Ignore-this: 9c18bdeaef4822f590d2a0d879e00621 |
---|
250 | ] |
---|
251 | Patch bundle hash: |
---|
252 | ebd185dcb1abb4aae3bd6612481d033cb03c38a4 |
---|