[REBOL] Re: load-thru
From: anton::wilddsl::net::au at: 10-Nov-2006 12:53
Hi Tim,
Yes, it works kind of the other way round than maybe expected.
It assumes you already know details of the new remote file.
This could be because you downloaded an index of all the remote
files first, with size/date/checksum information in it.
Note that LOAD-THRU uses READ-THRU which uses EXISTS-THRU? to see
whether the file is good or not.
Let's see... looking at source EXISTS-THRU?:
The supported INFO types are:
Type Example/Description
-------------------------
block [345 10-Nov-2006/12:22:30+11:00] ; size and/or date in any order
Either the cached file you have matches the date and size or else
EXISTS-THRU? returns false, which means READ-THRU will download and
cache it, and LOAD-THRU will LOAD it.
tuple 1.2.3 ; version number
Either the cached file's header you have has the same or greater
version number than the tuple (from the index) you supplied, or else
EXISTS-THRU? returns false.
binary #{F0885A6F3DBB7C024F4962B73B6E4711124F23BC} ; checksum/secure
Same again, the checksum you supply must match the checksum of the
cached file you have already.
logic TRUE ; or FALSE
A logic! just appears to be ignored. If the file is in the cache,
EXISTS-THRU? returns true, else false.
date 10-Nov-2006/12:37:31+11:00
Is placed inside a block and processed as block, above. Anyway, if
the date! of the cached file you have plus 3 seconds is still less
than the index date you supplied, then EXISTS-THRU? returns false.
none none
INFO is ignored. If the file exists in the cache then EXISTS-THRU?
returns it, so LOAD-THRU won't download it again.
Hope that helps.
Anton.