On Mon, 5 Mar 2007, Bill Kelly wrote:

> From: <ara.t.howard / noaa.gov>
>> On Mon, 5 Mar 2007, Bill Kelly wrote:
>>> What I'd like to be able to do, is make an arbitrary number
>>> of insert/delete (cut/paste) style edits on huge binary
>>> files (> 4 GB).  There should be minimal overhead for initially "opening" 
>>> the file, and the inserts and deletes should be very fast, until the 
>>> changes are finally
>>> committed.
>> 
>> i do exactly this using guy's ruby mmap bindings all the time, check out 
>> the
>> api - it might already do much of what you want to do.  one issue you may 
>> have
>> is addressing - since c ints map to ruby fixnums i'm not sure you'll be 
>> able
>> to map files quite this big with the pure ruby impl (not that it couldn't 
>> be
>> fixed and guy may already have fixed it).  anyhow, you could almost 
>> certainly
>> overcome this by mapping using length offset.  i otherwords, map 4 chunks 
>> of
>> 1gb.
>> 
>>  http://moulon.inra.fr/ruby/mmap.html
>
> Thanks!  Looking at the source, I think it may need to be
> using mmap64 to handle specifying offsets in files > 4GB,
> although I'm not positive.  (I don't need to map a huge
> amount of the file at once, just to specify huge offsets.)
>
> Also I'd need to get it working on Windows too (I wonder
> if guy would even accept a patch for that, <grin>.)

you can wrap it and the windows version that daniel berger did - it's in
rubyforge.

cheers.

-a
-- 
be kind whenever possible... it is always possible.
- the dalai lama