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// The type of persistence guarantee that PersistToDisk should provide. 26// Next tag: 3 27message PersistType { 28 enum Code { 29 // Default. Should never be used. 30 UNKNOWN = 0; 31 32 // Only persist the ground truth. A successful PersistToDisk(LITE) should 33 // ensure that no data is lost the next time Icing initializes. However, a 34 // recovery will be required unless a subsequent call to 35 // PersistToDisk(RECOVERY_PROOF) or PersistToDisk(FULL) is made before 36 // shutdown. This should be called after each batch of mutations. 37 LITE = 1; 38 39 // Persists all data in internal Icing components. A successful 40 // PersistToDisk(FULL) should not only ensure no data loss like 41 // PersistToDisk(LITE), but also prevent the need to recover internal data 42 // structures the next time Icing initializes. This should be called at 43 // some point before the app terminates. 44 FULL = 2; 45 46 // Persists the ground truth and updates the checksums of all internal Icing 47 // components. A successful PersistToDisk(RECOVERY_PROOF) should ensure that 48 // no data is lost and make it unlikely that a recovery is needed the next 49 // time Icing initializes. However, it is not guaranteed that a recovery 50 // will not be needed. This is because changes to index components may or 51 // may not be flushed to disk in the background and if some changes aren't 52 // persisted then we will have a checksum mismatch and a recovery. To 53 // guarantee that recovery won't occur PersistToDisk(FULL) must be called. 54 RECOVERY_PROOF = 3; 55 } 56 optional Code code = 1; 57} 58 59// Result of a call to IcingSearchEngine.Persist 60// Next tag: 2 61message PersistToDiskResultProto { 62 // Status code can be one of: 63 // OK 64 // FAILED_PRECONDITION 65 // INTERNAL 66 // 67 // See status.proto for more details. 68 optional StatusProto status = 1; 69} 70