/Source/EmUpConstants.h

http://google-email-uploader-mac.googlecode.com/ · C Header · 97 lines · 29 code · 23 blank · 45 comment · 0 complexity · 800a951f017565e93bff83318eec519b MD5 · raw file

  1. /* Copyright (c) 2009 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #import <Cocoa/Cocoa.h>
  16. #undef _EXTERN
  17. #undef _INITIALIZE_AS
  18. #ifdef EMUPCONSTANTS_DEFINE_GLOBALS
  19. #define _EXTERN
  20. #define _INITIALIZE_AS(x) =x
  21. #else
  22. #define _EXTERN extern
  23. #define _INITIALIZE_AS(x)
  24. #endif
  25. // no messages over 31 megs, per the API
  26. _EXTERN const unsigned int kMaxMesssageSize _INITIALIZE_AS(1024 * 1024 * 31);
  27. // uploading starts in fast mode, then changes to slow mode
  28. //
  29. // fast mode: up to 10 tickets pending at a time, roughly 5 per second
  30. //
  31. // slow mode: one ticket pending at a time, limited to 1 per second
  32. //
  33. // the mode changes from fast to slow after 500 fast messages, or when we
  34. // get a 503 status telling us to back off
  35. // 1 message per second in slow mode, estimate 5 per second in fast mode
  36. _EXTERN const NSTimeInterval kSlowUploadInterval _INITIALIZE_AS(1);
  37. _EXTERN const NSTimeInterval kFastUploadInterval _INITIALIZE_AS(0.2);
  38. // we'll have one 1 fetch pending at a time in slow mode, at most 10 at a time
  39. // in fast mode
  40. _EXTERN const unsigned int kSlowUploadMaxTickets _INITIALIZE_AS(1);
  41. _EXTERN const unsigned int kFastUploadMaxTickets _INITIALIZE_AS(10);
  42. // we can upload up to 500 messages in fast mode
  43. _EXTERN const unsigned int kFastModeMaxMessages _INITIALIZE_AS(500);
  44. // we won't intentionally create more tickets when 10 MB in messages
  45. // are uploading at once
  46. _EXTERN const unsigned int kMaxTotalUploadDataSize _INITIALIZE_AS(1024 * 1024 * 10);
  47. //
  48. // notifications
  49. //
  50. // counting messages for mailbox
  51. _EXTERN NSString* const kEmUpLoadingMailbox _INITIALIZE_AS(@"kEmUpLoadingMailbox");
  52. // message parsing failed
  53. _EXTERN NSString* const kEmUpMessageParsingFailed _INITIALIZE_AS(@"kEmUpMessageParsingFailed");
  54. //
  55. // property keys
  56. //
  57. // mailbox name to be used as a label for the entry when uploading
  58. _EXTERN NSString *const kEmUpMailboxNameKey _INITIALIZE_AS(@"kEmUpMailboxNameKey");
  59. // properties to be added to the GData entry
  60. _EXTERN NSString *const kEmUpMailboxPropertiesKey _INITIALIZE_AS(@"kEmUpMailboxPropertiesKey");
  61. // headers of this message, for diagnostic purposes
  62. _EXTERN NSString *const kEmUpMessageIDKey _INITIALIZE_AS(@"kEmUpMessageIDKey");
  63. // byte range of message
  64. _EXTERN NSString *const kEmUpMessageRangeKey _INITIALIZE_AS(@"kEmUpMessageRangeKey");
  65. // index in file of message, 0-based NSNumber
  66. _EXTERN NSString *const kEmUpMessageIndexKey _INITIALIZE_AS(@"kEmUpMessageIndexKey");
  67. // full path of message's file
  68. _EXTERN NSString *const kEmUpMessagePathKey _INITIALIZE_AS(@"kEmUpMessagePathKey");
  69. // error string
  70. _EXTERN NSString *const kEmUpMessageErrorStringKey _INITIALIZE_AS(@"kEmUpMessageErrorStringKey");
  71. // type of error
  72. _EXTERN NSString *const kEmUpMessageErrorType _INITIALIZE_AS(@"kEmUpMessageErrorType");
  73. _EXTERN NSString *const kEmUpMessageErrorTypeDuplicate _INITIALIZE_AS(@"duplicate");
  74. _EXTERN NSString *const kEmUpMessageErrorTypeServer _INITIALIZE_AS(@"server");