(I put an example program at the end.)
Travis Bemann wrote:
> My proposed interface (it is somewhat of a compromise):
>
> FreenetRequest : handles actual Freenet requests
> close() : transparently kill request (drop connection)
> get_data() : return data file
> get_metadata() : return metadata file (not currently used)
> get_status() : return tuple of (finished, reply message)
> Note that reply message is a string and may be None
> block() : block until request is finished
I was thinking along these lines, yes, only using the threading.Event object
interface.
> FreenetDataFile : same as current FreenetReadFile
> <like file object>
No longer relevant (since we need to verify incoming data).
> FreenetMetadataFile : like FreenetReadFile, but internally designed
> for handling metadata. <not currently used>
> FreenetKey : a wrapper object which stores Freenet keys
> __init__(part0, part1 = None, type = 'KSK')
Not sure we'll need this, but requests are next on my list, so I'll see.
=============================================================================
# Example program
import Freenet
# Start thread running select() loop which handles the Freenet connections
# for us.
Freenet.fncore.start(host="localhost", port=19114)
# Create a request object. The actual request will be handled by the thread
# we launched.
r = Freenet.messages.RequestKSK("/my/document", htl=17)
# Block until document is loaded - but we could be doing other stuff
meanwhile,
# too, instead of blocking.
r.wait()
print r.get_data().read()
--
Itamar S.T. itamar at maxnm.com
Fingerprint = D365 7BE8 B81E 2B18 6534 025E D0E7 92DB E441 411C
_______________________________________________
Freenet-dev mailing list
Freenet-dev at lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/freenet-dev