ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Net-FCP/README
(Generate patch)

Comparing cvsroot/Net-FCP/README (file contents):
Revision 1.7 by root, Sun Sep 14 09:48:01 2003 UTC vs.
Revision 1.9 by root, Sun Sep 28 08:58:07 2003 UTC

30 30
31 The import tag to use is named "event=xyz", e.g. "event=Event", 31 The import tag to use is named "event=xyz", e.g. "event=Event",
32 "event=Glib" etc. 32 "event=Glib" etc.
33 33
34 You should specify the event module to use only in the main program. 34 You should specify the event module to use only in the main program.
35
36 If no event model has been specified, FCP tries to autodetect it on
37 first use (e.g. first transaction), in this order: Coro, Event, Glib,
38 Tk.
35 39
36 FREENET BASICS 40 FREENET BASICS
37 Ok, this section will not explain any freenet basics to you, just some 41 Ok, this section will not explain any freenet basics to you, just some
38 problems I found that you might want to avoid: 42 problems I found that you might want to avoid:
39 43
53 THE Net::FCP CLASS 57 THE Net::FCP CLASS
54 $meta = Net::FCP::parse_metadata $string 58 $meta = Net::FCP::parse_metadata $string
55 Parse a metadata string and return it. 59 Parse a metadata string and return it.
56 60
57 The metadata will be a hashref with key "version" (containing the 61 The metadata will be a hashref with key "version" (containing the
58 mandatory version header entries). 62 mandatory version header entries) and key "raw" containing the
63 original metadata string.
59 64
60 All other headers are represented by arrayrefs (they can be 65 All other headers are represented by arrayrefs (they can be
61 repeated). 66 repeated).
62 67
63 Since this is confusing, here is a rather verbose example of a 68 Since this description is confusing, here is a rather verbose
64 parsed manifest: 69 example of a parsed manifest:
65 70
66 ( 71 (
72 raw => "Version...",
67 version => { revision => 1 }, 73 version => { revision => 1 },
68 document => [ 74 document => [
69 { 75 {
70 info => { format" => "image/jpeg" }, 76 info => { format" => "image/jpeg" },
71 name => "background.jpg", 77 name => "background.jpg",
152 operating_system => "Linux", 158 operating_system => "Linux",
153 operating_system_version => "2.4.20", 159 operating_system_version => "2.4.20",
154 routing_time => "a5", 160 routing_time => "a5",
155 } 161 }
156 162
157 $txn = $fcp->txn_generate_chk ($metadata, $data) 163 $txn = $fcp->txn_generate_chk ($metadata, $data[, $cipher])
158 $uri = $fcp->generate_chk ($metadata, $data) 164 $uri = $fcp->generate_chk ($metadata, $data[, $cipher])
159 Creates a new CHK, given the metadata and data. UNTESTED. 165 Calculcates a CHK, given the metadata and data. $cipher is either
166 "Rijndael" or "Twofish", with the latter being the default.
160 167
161 $txn = $fcp->txn_generate_svk_pair 168 $txn = $fcp->txn_generate_svk_pair
162 ($public, $private) = @{ $fcp->generate_svk_pair } 169 ($public, $private) = @{ $fcp->generate_svk_pair }
163 Creates a new SVK pair. Returns an arrayref. 170 Creates a new SVK pair. Returns an arrayref.
164 171
207 $meta can be a reference or a string (ONLY THE STRING CASE IS 214 $meta can be a reference or a string (ONLY THE STRING CASE IS
208 IMPLEMENTED!). 215 IMPLEMENTED!).
209 216
210 THIS INTERFACE IS UNTESTED AND SUBJECT TO CHANGE. 217 THIS INTERFACE IS UNTESTED AND SUBJECT TO CHANGE.
211 218
212 MISSING: (ClientPut), InsretKey 219 MISSING: (ClientPut), InsertKey
213 220
214 THE Net::FCP::Txn CLASS 221 THE Net::FCP::Txn CLASS
215 All requests (or transactions) are executed in a asynchroneous way (LIE: 222 All requests (or transactions) are executed in a asynchronous way. For
216 uploads are blocking). For each request, a "Net::FCP::Txn" object is 223 each request, a "Net::FCP::Txn" object is created (worse: a tcp
217 created (worse: a tcp connection is created, too). 224 connection is created, too).
218 225
219 For each request there is actually a different subclass (and it's 226 For each request there is actually a different subclass (and it's
220 possible to subclass these, although of course not documented). 227 possible to subclass these, although of course not documented).
221 228
222 The most interesting method is "result". 229 The most interesting method is "result".
253 260
254 $result = $txn->result 261 $result = $txn->result
255 Waits until a result is available and then returns it. 262 Waits until a result is available and then returns it.
256 263
257 This waiting is (depending on your event model) not very efficient, 264 This waiting is (depending on your event model) not very efficient,
258 as it is done outside the "mainloop". 265 as it is done outside the "mainloop". The biggest problem, however,
266 is that it's blocking one thread of execution. Try to use the
267 callback mechanism, if possible, and call result from within the
268 callback (or after is has been run), as then no waiting is
269 necessary.
259 270
260 The Net::FCP::Exception CLASS 271 The Net::FCP::Exception CLASS
261 Any unexpected (non-standard) responses that make it impossible to 272 Any unexpected (non-standard) responses that make it impossible to
262 return the advertised result will result in an exception being thrown 273 return the advertised result will result in an exception being thrown
263 when the "result" method is called. 274 when the "result" method is called.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines