xref: /aosp_15_r20/external/icing/icing/file/constants.h (revision 8b6cd535a057e39b3b86660c4aa06c99747c2136)
1*8b6cd535SAndroid Build Coastguard Worker // Copyright (C) 2024 Google LLC
2*8b6cd535SAndroid Build Coastguard Worker //
3*8b6cd535SAndroid Build Coastguard Worker // Licensed under the Apache License, Version 2.0 (the "License");
4*8b6cd535SAndroid Build Coastguard Worker // you may not use this file except in compliance with the License.
5*8b6cd535SAndroid Build Coastguard Worker // You may obtain a copy of the License at
6*8b6cd535SAndroid Build Coastguard Worker //
7*8b6cd535SAndroid Build Coastguard Worker //      http://www.apache.org/licenses/LICENSE-2.0
8*8b6cd535SAndroid Build Coastguard Worker //
9*8b6cd535SAndroid Build Coastguard Worker // Unless required by applicable law or agreed to in writing, software
10*8b6cd535SAndroid Build Coastguard Worker // distributed under the License is distributed on an "AS IS" BASIS,
11*8b6cd535SAndroid Build Coastguard Worker // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*8b6cd535SAndroid Build Coastguard Worker // See the License for the specific language governing permissions and
13*8b6cd535SAndroid Build Coastguard Worker // limitations under the License.
14*8b6cd535SAndroid Build Coastguard Worker 
15*8b6cd535SAndroid Build Coastguard Worker #ifndef ICING_FILE_CONSTANTS_H_
16*8b6cd535SAndroid Build Coastguard Worker #define ICING_FILE_CONSTANTS_H_
17*8b6cd535SAndroid Build Coastguard Worker 
18*8b6cd535SAndroid Build Coastguard Worker namespace icing {
19*8b6cd535SAndroid Build Coastguard Worker namespace lib {
20*8b6cd535SAndroid Build Coastguard Worker namespace constants {
21*8b6cd535SAndroid Build Coastguard Worker 
22*8b6cd535SAndroid Build Coastguard Worker // Icing internal max size for protos.
23*8b6cd535SAndroid Build Coastguard Worker //
24*8b6cd535SAndroid Build Coastguard Worker // WARNING: Changing this to a larger number may invalidate our assumption
25*8b6cd535SAndroid Build Coastguard Worker // that that proto size can safely be stored in the last 3 bytes of the proto
26*8b6cd535SAndroid Build Coastguard Worker // header.
27*8b6cd535SAndroid Build Coastguard Worker static constexpr int kMaxProtoSize = (1 << 24) - 1;  // 16MiB
28*8b6cd535SAndroid Build Coastguard Worker static_assert(kMaxProtoSize <= 0x00FFFFFF,
29*8b6cd535SAndroid Build Coastguard Worker               "kMaxProtoSize doesn't fit in 3 bytes");
30*8b6cd535SAndroid Build Coastguard Worker 
31*8b6cd535SAndroid Build Coastguard Worker }  // namespace constants
32*8b6cd535SAndroid Build Coastguard Worker }  // namespace lib
33*8b6cd535SAndroid Build Coastguard Worker }  // namespace icing
34*8b6cd535SAndroid Build Coastguard Worker 
35*8b6cd535SAndroid Build Coastguard Worker #endif  // ICING_FILE_CONSTANTS_H_
36