From: Kostyantyn Ovechko <fastinetserver2@gmail.com>
To: gentoo-soc <gentoo-soc@lists.gentoo.org>
Subject: [gentoo-soc] Project IDFetch - Weekly report #2
Date: Wed, 23 Jun 2010 21:13:48 +0300 [thread overview]
Message-ID: <1277316828.9059.5.camel@monapc> (raw)
In-Reply-To: <robbat2-20100602T182839-389048822Z@orbis-terrarum.net>
- Project IDFetch - Weekly report #2 -
==================================
Though, twrapper.py is a good thing to play with: it takes list
of files from pkg.list and starts downloading them
simultaneously. Nevertheless it uses wget tool for this and
communication between twrapper.py has some serious limitations
especially when it comes to controling simultaneous downloads
(speed, segments, etc). So next step for idfetch project was to
make its own tool for segmented file fetching.
1. [Replacing stuff]
Started from replacing chocolate module by dates [1] (i still
use coffee though), python by cpp, wget by libcurl [2].
2. [JSON struggles]. Going cpp grows my love to python.
2.1 Using python
2.1.1 Saving json data with python
To save data to json-formated pkg.list fetch.py
uses following lines:
import json
idfetch_pkg_list_file.write(json.dumps(idfetch_pkg_list, sort_keys=1, indent=4))
2.1.2 Loading json data with python
To load data from json-formated pkg.list
twrapper.py uses these 2 lines:
import json
idfetch_pkg_list=json.loads(idfetch_pkg_list_file.read())
2.2 Using cpp
2.2.1 Loading json data with cpp
Reading data in cpp resulted in:
a) #emerge json-c
b) g++ -o task task.c -ljson (where
task.c has 146 lines of code = 5037
bytes);
c++) minus one day spend on these 146
lines of code.
3. [Discovering libcurl].
It's the first time I use libcurl for my project (Thanks to
Robin H. Johnson). Libcurl happened to be pretty interesting lib
with lots of opportunities to discover and implement into
idfetch. Therefore I only hope not to bump into some grueling
bug or limitation.
4. [Downloading with libcurl].
Experiments at stage 3 resulted in segget.cpp. Segget downloads
files, splitting them into segments. It's possible to set number of
parallel connections for segget. After fetching segments, segget
combines them together to provide original file (no checksum check
implemented yet).
[1] http://en.wikipedia.org/wiki/Phoenix_dactylifera
[2] http://curl.haxx.se/libcurl/
Best regards,
Kostyantyn Ovechko AKA simka
parent reply other threads:[~2010-06-23 18:13 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <robbat2-20100602T182839-389048822Z@orbis-terrarum.net>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1277316828.9059.5.camel@monapc \
--to=fastinetserver2@gmail.com \
--cc=gentoo-soc@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox