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
19option java_package = "com.google.android.icing.proto";
20option java_multiple_files = true;
21
22option objc_class_prefix = "ICNG";
23
24// Canonical status to indicate the results of API calls.
25// Next tag: 3
26message StatusProto {
27  // Next tag: 10
28  enum Code {
29    // A default for all other use-cases. Should never be used in practice. This
30    // may happen if there are backwards-compatibility issues.
31    UNKNOWN = 0;
32
33    // Returned on success.
34    OK = 1;
35
36    // The IcingSearchEngine instance is still usable. But the schema and/or
37    // documents may need to be re-added to prevent future API calls from
38    // failing or returning correct information.
39    //
40    // TODO(b/171750324): split into WARNING_PARTIAL_LOSS and
41    // WARNING_COMPLETE_LOSS.
42    WARNING_DATA_LOSS = 2;
43
44    // Parameters to API call are invalid and cannot be processed.
45    INVALID_ARGUMENT = 3;
46
47    // Requested thing does not exist.
48    NOT_FOUND = 4;
49
50    // System preconditions are not met to properly execute the operation.
51    FAILED_PRECONDITION = 5;
52
53    // Operation was aborted before any modifications were made to
54    // IcingSearchEngine; all data is in the same state. Try calling the API
55    // again later.
56    ABORTED = 6;
57
58    // An internal state is inconsistent and data may not be preserved. To fix,
59    // try closing the current instance of IcingSearchEngine, recreating it, and
60    // calling Initialize again. If the problem still persists, remove all data
61    // by calling Clear, then Initialize again.
62    INTERNAL = 7;
63
64    // Out of storage space. Try running Optimize to reclaim internal space, or
65    // make some space on the underlying filesystem.
66    OUT_OF_SPACE = 8;
67
68    // An operation is invalid because the resource already exists and can't be
69    // replaced. For example, this status is used when a SchemaProto contains
70    // multiple definitions of the same type or multiple properties with the
71    // same name within a type.
72    ALREADY_EXISTS = 9;
73
74    // Any future status codes.
75  }
76  optional Code code = 1;
77
78  // Any extra information about the status.
79  optional string message = 2;
80}
81