Archived
1
0
Fork 0
Commit graph

15 commits

Author SHA1 Message Date
Henrik Hautakoski
e85b3b7993 dlhist.c: use file_cmp from utils.h instead of static path_cmp. 2013-02-08 21:55:12 +01:00
Henrik Hautakoski
b65c9e74aa dlhist.c: don't include '\n' in calls to error() 2012-08-15 15:43:38 +02:00
Henrik Hautakoski
4a8fcb6062 dlhist.c: Fix typo in dlhist_flush() 2012-08-15 15:43:38 +02:00
Henrik Hautakoski
37ba894802 make dlight.c use the new dlhist 2011-12-15 13:35:13 +01:00
Henrik Hautakoski
40e6afeffa adding new dlhist.c 2011-12-15 13:29:23 +01:00
Henrik Hautakoski
1350330dd2 dlhist: rename to proc-cache.
A new datastructure is about to take dlhist place. dlhist is currently
implemented as a mixture of an "process cache" that should record what
rss items has been processed (that is why the url is used as a unique
identifier), but right now it only stores an url if it has been
downloaded. A new datastructure that should be "download history"
shall be implemented, that will keep track of what title and where
it has been downloaded to. this will make it possible to only
download an rss title to a location once.

Splitting this datastructure into two separated structures is trivial
as a "process cache" will threat URL's as a unique identifier and
a "download history" will threat the title in an rss item as a
unique identifier (and also track it's destinations).

This commit does not change any functionality, I just rename
this to keep the "dlhist" prefix and source files clear for
when implementing the real dlhist.
2011-11-14 16:11:18 +01:00
Henrik Hautakoski
378de035de dlhist.c: dlhist_lookup: pass a variable to he_empty().
he_empty() is a macro, do not pass a function call as argument.
when the macro expands, the function will be called numerous times.
2011-11-03 14:36:10 +01:00
Henrik Hautakoski
a0f46daa4a dlhist.c: store number of entries in header instead of table size
Now that table size can be calculated, lets store the number of entries
instead of size in the header so we can rely on that when reading
entries, instead of the actual size on disk. this is safer if data is
appended to the file outside of the application.
2011-11-03 13:42:59 +01:00
Henrik Hautakoski
bbefd9daf5 dlhist.c: calculate initial size when read table from file.
Now that records are fixed size, it's easy to calculate the number of
entries in the file. use that to calculate how large the hash table
should be.
2011-11-03 13:10:30 +01:00
Henrik Hautakoski
9517d28f72 dlhist.c: do linear-probing when inserting entries.
Somehow I apperently missed to do linear probing in he_insert that
results in colliding entries read from file (and when resizing)
to be dropped on the floor.

Lets not drop things on the floor anymore, certainly there is
another place in the table that will do fine instead of just
giving up and throw it on the floor.
2011-10-26 16:48:29 +01:00
Henrik Hautakoski
6758b06188 dlhist: use sha1 hashes as keys to make records fixed size.
use sha1 hashes instead of c-strings to make records fixed size.
because it's hard to find collisions in sha1 hashes, this works well
in practise. And dynamic memory allocation for the variadic size keys
is not needed anymore. space is also reduced due to most key strings being
more than 20 bytes long.

calculating sha1 should be fast enough to not make any more overhead
than dynamic memory allocation did.
2011-10-04 15:29:45 +02:00
Henrik Hautakoski
5eda6e7705 dlhist.c: resize_table: Oops, storing floating point value in integer. 2011-09-21 17:19:12 +02:00
Henrik Hautakoski
bb5963dbf6 License with GPLv2 2011-09-21 17:19:09 +02:00
Henrik Hautakoski
06dca6c150 dlhist.c: use lockfile 2011-09-21 17:19:09 +02:00
Henrik Hautakoski
b2df740514 Initial commit 2011-09-21 17:13:28 +02:00