changeset 1220:9e0aa3c568d1
One TODO list per project -- copy contents of Dillo's
"Proposal for the I/O Abstraction Layer" into the TODO.
| author | Thomas Klausner <tk@giga.or.at> |
|---|---|
| date | Sat, 01 Sep 2012 00:57:52 +0200 |
| parents | fd6134107791 |
| children | 2c7e9ad80cd0 |
| files | TODO |
| diffstat | 1 files changed, 55 insertions(+), 0 deletions(-) [+] |
line diff
1.1 --- a/TODO Fri Aug 31 21:47:59 2012 +0200 1.2 +++ b/TODO Sat Sep 01 00:57:52 2012 +0200 1.3 @@ -122,3 +122,58 @@ 1.4 * (strerror) 1.5 * (unchange) 1.6 * (unchange_all) 1.7 + 1.8 + 1.9 +I/O Methods 1.10 +=========== 1.11 +One major headache for libzip portability (especially to Windows) is 1.12 +I/O, i.e. reading and writing from the file system. Also, there 1.13 +have been requests to open zip archives from a memory buffer. To 1.14 +address these issues, we'll introduce an I/O abstraction layer. 1.15 + 1.16 + We'll reuse zip_source, since it already provides support for 1.17 +the reading part, adding high level abstraction of the additional 1.18 +operations needed. This way, newly written zip_sources can be used 1.19 +both for adding files into an archive as well as for accessing archives 1.20 +themselves. 1.21 + 1.22 +Specifically, we'll add these commands: 1.23 + 1.24 +ZIP_SOURCE_BEGIN_WRITE 1.25 + Prepare for writing. The written data will replace all 1.26 + original data. The file position is reset to 0. (On POSIX 1.27 + systems, this will create a temporary file and open it for 1.28 + writing.) 1.29 + 1.30 +ZIP_SOURCE_WRITE 1.31 + Write bytes of data, a la fwrite(3) (does not need to know 1.32 + anything about the zip archive structure). 1.33 + 1.34 +ZIP_SOURCE_COMMIT_WRITE 1.35 + Used after all data has been written successfully. (On 1.36 + POSIX systems, this will replace the original file with 1.37 + the temporary file, adapting permissions etc.) 1.38 +ZIP_SOURCE_ROLLBACK_WRITE 1.39 + because writing failed) to restore original data if possible; 1.40 + return an errohis will 1.41 + delete the temporary file.) 1.42 + 1.43 +ZIP_SOURCE_SEEK 1.44 + Set postion for next read or write, a la fseek(3). 1.45 + 1.46 +ZIP_SOURCE_SUPPORTS 1.47 + Query which commands are supported for this stream. If a 1.48 + file cannot be written to, this will report ZIP_SOURCE_BEGIN_WRITE 1.49 + as not supported, even if the source type would support 1.50 + write. (This is used in zip_open to set global flags like 1.51 + ZIP_AFL_RDONLY.) 1.52 + 1.53 + We'll provide a zip_open variant that takes a zip_source argument 1.54 +used for reading/writing archives. Using an enhanced version of 1.55 +zip_source_buffer, this can be used to read zip archives from memory. 1.56 + 1.57 + zip_open itself will create a source from the file using a 1.58 +port-specific default implementation (POSIX vs. Windows vs. ...). 1.59 + 1.60 + Once the details are finalized, we'll ask for volunteers for writing 1.61 +a Windows specific implementation.
