Danek Duvall wrote:
Shawn Walker wrote:
No, that option is fine (and I greatly appreciate the suggestion!),
although it does seem to indicate that I will have to either:
* serialize the result to a string and do a search and replace in the
string (not so pretty from memory usage standpoint) and then save
* perform a seek in the file searching for the dummy signature value
string and then replace it with my own (number of ways to do this)
and then re-save
You could combine the two: do the search in the in-memory copy to find the
location, then write to disk, then seek to the location you saved and write
the bytes down.
Possibly, but ...
Currently, the serialized result is never stored in-memory to keep the
memory footprint smaller. The data structure is currently directly
serialized to disk. Given that the serialized result on-disk can be as
large as 22 megabytes (currently), I don't think I want to do that ;)
However, I could probably cheat and give json.dump() a sub-classed file
objects and intercept the writes as they happen to find the offset and
then pass the data onto the real file object for writing.
Then, when the file is close()'d I could go back and replace the
signature as you've suggested.
Too hacky?
Cheers,
--
Shawn Walker
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss