Re: [Evolution-hackers] mmap() for the summary file

The howto,

- Add a flag to CamelFolderSummaryFlags CAMEL_SUMMARY_MAPPING_READY

- Add a summary_filedes FILE, a summary_mapping void* and a
  summary_start void* to the CamelFolderSummary

- Replace the summary_header_load with the version I attached

- Adjust camel_folder_summary_load
	- Add a check that will delete and regenerate the summary file
	  if the version is < 14

	- Do the mmap and start loading the message-info's by reading
	  the header for the length and one by one calling message_info_load 
	  (like the current implementation). AND the flags with CAMEL_SUMMARY_

- Reimplement message_info_load, 
	- implement a helper method that will decode an encoded int32
	  from a mmap memory block (in stead of from a int
	  filedescriptor). Probably a lot like the one I attached.

	- Assign the char* pointers in s to addresses in the mmap block

	- Calculate the next address using the current address and the
	  length of the current string.

		- Question about mmap, is this type of seeking through
		  the file going to be faster than simply reading every
		  byte by searching for '\0'? I'm guessing it is faster.

	- Copy int32's and uint32's to the struct (doesn't have to be
	  pointers as that wouldn't make much difference)

- Adjust message_info_save

	- add a '\0' to each string and increase the length of the
	  string with one byte (the '\0' byte). I.e. Create a new
	  camel_file_util_encode_string that does this.

	- unmmap summary_mapping, OR the flags with CAMEL_SUMMARY

	- call the camel_folder_summary_load to reload the mapping
	 (maybe in a background worker thread)

- test
	- :-) ?
	- :-) !
	- :.( ?

Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be -

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]