PageRenderTime 31ms CodeModel.GetById 9ms app.highlight 16ms RepoModel.GetById 2ms app.codeStats 0ms

/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
16#import <Cocoa/Cocoa.h>
17
18#undef _EXTERN
19#undef _INITIALIZE_AS
20#ifdef EMUPCONSTANTS_DEFINE_GLOBALS
21#define _EXTERN 
22#define _INITIALIZE_AS(x) =x
23#else
24#define _EXTERN extern
25#define _INITIALIZE_AS(x)
26#endif
27
28
29// no messages over 31 megs, per the API
30_EXTERN const unsigned int kMaxMesssageSize _INITIALIZE_AS(1024 * 1024 * 31);
31
32// uploading starts in fast mode, then changes to slow mode
33//
34// fast mode: up to 10 tickets pending at a time, roughly 5 per second
35//
36// slow mode: one ticket pending at a time, limited to 1 per second
37//
38// the mode changes from fast to slow after 500 fast messages, or when we
39// get a 503 status telling us to back off
40
41// 1 message per second in slow mode, estimate 5 per second in fast mode
42_EXTERN const NSTimeInterval kSlowUploadInterval   _INITIALIZE_AS(1);
43_EXTERN const NSTimeInterval kFastUploadInterval   _INITIALIZE_AS(0.2);
44
45// we'll have one 1 fetch pending at a time in slow mode, at most 10 at a time
46// in fast mode
47_EXTERN const unsigned int kSlowUploadMaxTickets   _INITIALIZE_AS(1);
48_EXTERN const unsigned int kFastUploadMaxTickets   _INITIALIZE_AS(10);
49
50// we can upload up to 500 messages in fast mode
51_EXTERN const unsigned int kFastModeMaxMessages _INITIALIZE_AS(500);
52
53// we won't intentionally create more tickets when 10 MB in messages
54// are uploading at once
55_EXTERN const unsigned int kMaxTotalUploadDataSize _INITIALIZE_AS(1024 * 1024 * 10);
56
57//
58// notifications
59//
60
61// counting messages for mailbox
62_EXTERN NSString* const kEmUpLoadingMailbox _INITIALIZE_AS(@"kEmUpLoadingMailbox");
63
64// message parsing failed
65_EXTERN NSString* const kEmUpMessageParsingFailed _INITIALIZE_AS(@"kEmUpMessageParsingFailed");
66
67
68//
69// property keys
70//
71
72// mailbox name to be used as a label for the entry when uploading
73_EXTERN NSString *const kEmUpMailboxNameKey       _INITIALIZE_AS(@"kEmUpMailboxNameKey");
74
75// properties to be added to the GData entry
76_EXTERN NSString *const kEmUpMailboxPropertiesKey _INITIALIZE_AS(@"kEmUpMailboxPropertiesKey");
77
78// headers of this message, for diagnostic purposes
79_EXTERN NSString *const kEmUpMessageIDKey  _INITIALIZE_AS(@"kEmUpMessageIDKey");
80
81// byte range of message
82_EXTERN NSString *const kEmUpMessageRangeKey  _INITIALIZE_AS(@"kEmUpMessageRangeKey");
83
84// index in file of message, 0-based NSNumber
85_EXTERN NSString *const kEmUpMessageIndexKey  _INITIALIZE_AS(@"kEmUpMessageIndexKey");
86
87// full path of message's file
88_EXTERN NSString *const kEmUpMessagePathKey  _INITIALIZE_AS(@"kEmUpMessagePathKey");
89
90// error string
91_EXTERN NSString *const kEmUpMessageErrorStringKey  _INITIALIZE_AS(@"kEmUpMessageErrorStringKey");
92
93// type of error
94_EXTERN NSString *const kEmUpMessageErrorType  _INITIALIZE_AS(@"kEmUpMessageErrorType");
95_EXTERN NSString *const kEmUpMessageErrorTypeDuplicate  _INITIALIZE_AS(@"duplicate");
96_EXTERN NSString *const kEmUpMessageErrorTypeServer     _INITIALIZE_AS(@"server");
97