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: 4 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 40 // If Icing does not manage blob files, this field will be the list of blob 41 // file names that should be removed. Otherwise, this field will be empty. 42 repeated string blob_file_names_to_remove = 3; 43 44 // TODO(b/147699081): Add a field to indicate lost_schema and lost_documents. 45 // go/icing-library-apis. 46} 47 48// Result of a call to IcingSearchEngine.GetOptimizeInfo 49// Next tag: 5 50message GetOptimizeInfoResultProto { 51 // Status code can be one of: 52 // OK 53 // FAILED_PRECONDITION 54 // INTERNAL 55 // 56 // See status.proto for more details. 57 optional StatusProto status = 1; 58 59 // Documents that have expired or been deleted, but are still taking up space 60 // in IcingSearchEngine. 61 optional int64 optimizable_docs = 2; 62 63 // Estimated bytes that could be recovered. The exact size per document isn't 64 // tracked, so this is based off an average document size. 65 optional int64 estimated_optimizable_bytes = 3; 66 67 // The amount of time since the last optimize ran. 68 optional int64 time_since_last_optimize_ms = 4; 69} 70 71// Next tag: 14 72message OptimizeStatsProto { 73 // Overall time used for the function call. 74 optional int32 latency_ms = 1; 75 76 // Time used to optimize the document store. 77 optional int32 document_store_optimize_latency_ms = 2; 78 79 // Time used to restore the index. 80 optional int32 index_restoration_latency_ms = 3; 81 82 // Number of documents before the optimization. 83 optional int32 num_original_documents = 4; 84 85 // Number of documents deleted. 86 optional int32 num_deleted_documents = 5; 87 88 // Number of documents expired. 89 optional int32 num_expired_documents = 6; 90 91 // Size of storage before the optimize. 92 optional int64 storage_size_before = 7; 93 94 // Size of storage after the optimize. 95 optional int64 storage_size_after = 8; 96 97 // The amount of time since the last optimize ran. 98 optional int64 time_since_last_optimize_ms = 9; 99 100 // The amount of time since the last successful optimize run. 101 optional int64 time_since_last_successful_optimize_ms = 13; 102 103 enum IndexRestorationMode { 104 // The index has been translated in place to match the optimized document 105 // store. 106 INDEX_TRANSLATION = 0; 107 // The index has been rebuilt from scratch during optimization. This could 108 // happen when we received a DATA_LOSS error from OptimizeDocumentStore, 109 // Index::Optimize failed, or rebuilding could be faster. 110 FULL_INDEX_REBUILD = 1; 111 } 112 optional IndexRestorationMode index_restoration_mode = 10; 113 114 // Number of namespaces before the optimization. 115 optional int32 num_original_namespaces = 11; 116 117 // Number of namespaces deleted. 118 optional int32 num_deleted_namespaces = 12; 119} 120