1// Copyright 2021 Google LLC
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
15syntax = "proto2";
16
17package icing.lib;
18
19import "icing/proto/status.proto";
20
21option java_package = "com.google.android.icing.proto";
22option java_multiple_files = true;
23option objc_class_prefix = "ICNG";
24
25// Next tag: 10
26message NamespaceStorageInfoProto {
27  // Name of the namespace
28  optional string namespace = 1;
29
30  // Number of alive documents in this namespace.
31  optional int32 num_alive_documents = 2;
32
33  // NOTE: We don't have stats on number of deleted documents in a namespace
34  // since we completely erase all data on a document when it's deleted. And we
35  // can't figure out which namespace it belonged to.
36
37  // Number of expired documents in this namespace.
38  optional int32 num_expired_documents = 3;
39
40  // LINT.IfChange(namespace_storage_info_usage_types)
41  // Number of alive documents that have a UsageReport.usage_type reported
42  optional int32 num_alive_documents_usage_type1 = 4;
43  optional int32 num_alive_documents_usage_type2 = 5;
44  optional int32 num_alive_documents_usage_type3 = 6;
45
46  // Number of expired documents that have a UsageReport.usage_type reported
47  optional int32 num_expired_documents_usage_type1 = 7;
48  optional int32 num_expired_documents_usage_type2 = 8;
49  optional int32 num_expired_documents_usage_type3 = 9;
50  // LINT.ThenChange()
51}
52
53// Next tag: 15
54message DocumentStorageInfoProto {
55  // Total number of alive documents.
56  optional int32 num_alive_documents = 1;
57
58  // Total number of deleted documents.
59  optional int32 num_deleted_documents = 2;
60
61  // Total number of expired documents.
62  optional int32 num_expired_documents = 3;
63
64  // Total size of the document store in bytes. Will be set to -1 if an IO error
65  // is encountered while calculating this field.
66  optional int64 document_store_size = 4;
67
68  // Total size of the ground truth in bytes. The ground truth may
69  // include deleted or expired documents. Will be set to -1 if an IO error is
70  // encountered while calculating this field.
71  optional int64 document_log_size = 5;
72
73  // Size of the key mapper in bytes. Will be set to -1 if an IO error is
74  // encountered while calculating this field.
75  optional int64 key_mapper_size = 6;
76
77  // Size of the document id mapper in bytes. Will be set to -1 if an IO error
78  // is encountered while calculating this field.
79  optional int64 document_id_mapper_size = 7;
80
81  // Size of the score cache in bytes. Will be set to -1 if an IO error is
82  // encountered while calculating this field.
83  optional int64 score_cache_size = 8;
84
85  // Size of the filter cache in bytes. Will be set to -1 if an IO error is
86  // encountered while calculating this field.
87  optional int64 filter_cache_size = 9;
88
89  // Size of the corpus mapper in bytes. Will be set to -1 if an IO error is
90  // encountered while calculating this field.
91  optional int64 corpus_mapper_size = 10;
92
93  // Size of the corpus score cache in bytes. Will be set to -1 if an IO error
94  // is encountered while calculating this field.
95  optional int64 corpus_score_cache_size = 11;
96
97  // Size of the namespace id mapper in bytes. Will be set to -1 if an IO error
98  // is encountered while calculating this field.
99  optional int64 namespace_id_mapper_size = 12;
100
101  // Number of namespaces seen from the current documents.
102  //
103  // TODO(cassiewang): This isn't technically needed anymore since clients can
104  // get this number from namespace_storage_info. Consider removing this.
105  optional int32 num_namespaces = 13;
106
107  // Storage information of each namespace.
108  repeated NamespaceStorageInfoProto namespace_storage_info = 14;
109}
110
111// Next tag: 5
112message SchemaStoreStorageInfoProto {
113  // Size of the schema store in bytes. Will be set to -1 if an IO error is
114  // encountered while calculating this field.
115  optional int64 schema_store_size = 1;
116
117  // Total number of schema types.
118  optional int32 num_schema_types = 2;
119
120  // Total number of all sections across all types
121  optional int32 num_total_sections = 3;
122
123  // Total number of types at the current section limit.
124  optional int32 num_schema_types_sections_exhausted = 4;
125}
126
127// Next tag: 9
128message IndexStorageInfoProto {
129  // Total size of the index in bytes. Will be set to -1 if an IO error is
130  // encountered while calculating this field.
131  optional int64 index_size = 1;
132
133  // Size of the lite index lexicon in bytes. Will be set to -1 if an IO error
134  // is encountered while calculating this field.
135  optional int64 lite_index_lexicon_size = 2;
136
137  // Size of the lite index hit buffer in bytes. Will be set to -1 if an IO
138  // error is encountered while calculating this field.
139  optional int64 lite_index_hit_buffer_size = 3;
140
141  // Size of the main index lexicon in bytes. Will be set to -1 if an IO error
142  // is encountered while calculating this field.
143  optional int64 main_index_lexicon_size = 4;
144
145  // Size of the main index storage in bytes. Will be set to -1 if an IO error
146  // is encountered while calculating this field.
147  optional int64 main_index_storage_size = 5;
148
149  // Size of one main index block in bytes.
150  optional int64 main_index_block_size = 6;
151
152  // Number of main index blocks.
153  optional int32 num_blocks = 7;
154
155  // Percentage of the main index blocks that are free, assuming
156  // allocated blocks are fully used.
157  optional float min_free_fraction = 8;
158}
159
160// Next tag: 5
161message StorageInfoProto {
162  // Total size of Icing’s storage in bytes. Will be set to -1 if an IO error is
163  // encountered while calculating this field.
164  optional int64 total_storage_size = 1;
165
166  // Storage information of the document store.
167  optional DocumentStorageInfoProto document_storage_info = 2;
168
169  // Storage information of the schema store.
170  optional SchemaStoreStorageInfoProto schema_store_storage_info = 3;
171
172  // Storage information of the index.
173  optional IndexStorageInfoProto index_storage_info = 4;
174}
175
176// Next tag: 3
177message StorageInfoResultProto {
178  // Status code can be one of:
179  //   OK
180  //   FAILED_PRECONDITION
181  //
182  // See status.proto for more details.
183  optional StatusProto status = 1;
184
185  // Storage information of Icing.
186  optional StorageInfoProto storage_info = 2;
187}
188