1// Copyright 2010-2018, Google Inc.
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met:
7//
8//     * Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10//     * Redistributions in binary form must reproduce the above
11// copyright notice, this list of conditions and the following disclaimer
12// in the documentation and/or other materials provided with the
13// distribution.
14//     * Neither the name of Google Inc. nor the names of its
15// contributors may be used to endorse or promote products derived from
16// this software without specific prior written permission.
17//
18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30syntax = "proto2";
31
32package mozc;
33
34option java_outer_classname = "ProtoEngineBuilder";
35option java_package = "org.mozc.android.inputmethod.japanese.protobuf";
36
37message EngineReloadRequest {
38  // Specify the type of engine to build.
39  enum EngineType {
40    DESKTOP = 0;
41    MOBILE = 1;
42  }
43  required EngineType engine_type = 1;
44
45  // Path to the data file to be loaded in a new engine.
46  required string file_path = 2;
47
48  // If provided, also atomically renames |file_path| to this location.  Since
49  // EngineBuilder validates the data file content before creating a new engine
50  // instance, this option is useful when you want to perform i) data
51  // verification, ii) install (file rename), and iii) engine reload at the same
52  // time in Mozc server side.
53  optional string install_location = 3;
54
55  // Explicitly specifies the magic number to be used for data validation.
56  // Since acceptable magic number is embedded in Mozc server, this option is
57  // unnecessary for normal cases.  However, this is required for some unit
58  // tests as test data has a different magic number.
59  optional string magic_number = 4;
60}
61
62message EngineReloadResponse {
63  enum Status {
64    // Reload command is accepted.
65    ACCEPTED = 0;
66
67    // New data is verified and ready.
68    RELOAD_READY = 1;
69
70    // Engine was replaced by a new instance.
71    RELOADED = 2;
72
73    // The following are errors.
74
75    // Failed to start reload becuase another reload job is currently running.
76    ALREADY_RUNNING = 3;
77
78    // Erros in data file.
79    ENGINE_VERSION_MISMATCH = 4;
80    DATA_MISSING = 5;
81    DATA_BROKEN = 6;
82
83    // File doesn't exist or underlying memory mapping failed.
84    MMAP_FAILURE = 7;
85
86    // File rename is failed.
87    INSTALL_FAILURE = 8;
88
89    UNKNOWN_ERROR = 9;
90  }
91  required Status status = 1;
92
93  // The original request is copied in response for convenience (the reload
94  // command runs asynchronously but client doesn't need to keep the original
95  // request).
96  optional EngineReloadRequest request = 2;
97}
98