On Tue, Aug 15, 2000 at 11:48:38AM +0300, Itamar Shtull-Trauring wrote:
> Brandon wrote:
> >
> > > However, in order to support other keytypes, I'm trying to rewrite the
> > > whole
> > > library from scratch. Whatever code I have of the new version will be at
> > > http://www.sourceforge.net/projects/freenet-python once the project is
> > > approved by SF.
> >
> > I hope you keep the API the same! I'd hate to have to rewrite my NNTP
> > gateway when it's working so nicely.
>
> The problem is that the current API basically blocks on a request, doesn't
> have support for anything but KSKs, and so on. Writing a compatability
> wrapper (for KSKs only) might be possible, however. I'm not sure what the
> new API will look like - to request, you'll create a RequestKSK or
> RequestCHK object, which at some future point will tell you that it
> suceeded/failed. Either as an attribute which you can check, or a callback.
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
FreenetInsert : handles actual Freenet inserts
close() : transparently kill insert (drop connection)
get_status() : return tuple of (finished, reply message)
Note that reply message is a string and may be None
block() : block until insert is finished
FreenetDataFile : same as current FreenetReadFile
<like file object>
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')
Freenet : the guts of freenetlib
__init__(host = DEFAULT_HOST,
port = DEFAULT_PORT,
lo_request_htl = DEFAULT_LO_REQUEST_HTL,
hi_request_htl = DEFAULT_HI_REQUEST_HTL,
lo_insert_htl = DEFAULT_LO_INSERT_HTL,
hi_insert_htl = DEFAULT_HI_INSERT_HTL,
lo_depth = DEFAULT_LO_DEPTH,
hi_depth = DEFAULT_HI_DEPTH,
verbosity = DEFAULT_VERBOSITY,
log_file = DEFAULT_LOG_FILE)
request(key) : request key, return FreenetRequest object
insert(key, data_file, metadata_file = None) : insert key, return
FreenetInsert object
--
Travis Bemann
Sendmail is still screwed up on my box.
My email address is really bemann at execpc.com.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 2080 bytes
Desc: not available
URL:
<https://emu.freenetproject.org/pipermail/devl/attachments/20000815/9b76a36a/attachment.pgp>