1// Copyright 2019 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// Result of a call to IcingSearchEngine.Optimize 26// Next tag: 3 27message OptimizeResultProto { 28 // Status code can be one of: 29 // OK 30 // FAILED_PRECONDITION 31 // WARNING_DATA_LOSS 32 // ABORTED 33 // INTERNAL 34 // 35 // See status.proto for more details. 36 optional StatusProto status = 1; 37 38 optional OptimizeStatsProto optimize_stats = 2; 39 // TODO(b/147699081): Add a field to indicate lost_schema and lost_documents. 40 // go/icing-library-apis. 41} 42 43// Result of a call to IcingSearchEngine.GetOptimizeInfo 44// Next tag: 5 45message GetOptimizeInfoResultProto { 46 // Status code can be one of: 47 // OK 48 // FAILED_PRECONDITION 49 // INTERNAL 50 // 51 // See status.proto for more details. 52 optional StatusProto status = 1; 53 54 // Documents that have expired or been deleted, but are still taking up space 55 // in IcingSearchEngine. 56 optional int64 optimizable_docs = 2; 57 58 // Estimated bytes that could be recovered. The exact size per document isn't 59 // tracked, so this is based off an average document size. 60 optional int64 estimated_optimizable_bytes = 3; 61 62 // The amount of time since the last optimize ran. 63 optional int64 time_since_last_optimize_ms = 4; 64} 65 66// Next tag: 11 67message OptimizeStatsProto { 68 // Overall time used for the function call. 69 optional int32 latency_ms = 1; 70 71 // Time used to optimize the document store. 72 optional int32 document_store_optimize_latency_ms = 2; 73 74 // Time used to restore the index. 75 optional int32 index_restoration_latency_ms = 3; 76 77 // Number of documents before the optimization. 78 optional int32 num_original_documents = 4; 79 80 // Number of documents deleted. 81 optional int32 num_deleted_documents = 5; 82 83 // Number of documents expired. 84 optional int32 num_expired_documents = 6; 85 86 // Size of storage before the optimize. 87 optional int64 storage_size_before = 7; 88 89 // Size of storage after the optimize. 90 optional int64 storage_size_after = 8; 91 92 // The amount of time since the last optimize ran. 93 optional int64 time_since_last_optimize_ms = 9; 94 95 enum IndexRestorationMode { 96 // The index has been translated in place to match the optimized document 97 // store. 98 INDEX_TRANSLATION = 0; 99 // The index has been rebuilt from scratch during optimization. This could 100 // happen when we received a DATA_LOSS error from OptimizeDocumentStore, 101 // Index::Optimize failed, or rebuilding could be faster. 102 FULL_INDEX_REBUILD = 1; 103 } 104 optional IndexRestorationMode index_restoration_mode = 10; 105} 106