game_machine 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +72 -0
  4. data/Rakefile +38 -0
  5. data/bin/game_machine +79 -0
  6. data/config/cluster.conf +65 -0
  7. data/config/config.example.yml +93 -0
  8. data/config/game_messages.proto +45 -0
  9. data/config/messages.proto +339 -0
  10. data/config/regions.example.yml +9 -0
  11. data/config/standalone.conf +36 -0
  12. data/db/do_not_delete +0 -0
  13. data/game_machine.gemspec +38 -0
  14. data/games/example/boot.rb +6 -0
  15. data/games/example/data/game_data.yml +13 -0
  16. data/games/example/lib/aggressive_npc.rb +176 -0
  17. data/games/example/lib/authentication_handler.rb +69 -0
  18. data/games/example/lib/chatbot.rb +61 -0
  19. data/games/example/lib/combat_controller.rb +145 -0
  20. data/games/example/lib/example_controller.rb +21 -0
  21. data/games/example/lib/game.rb +85 -0
  22. data/games/example/lib/models/attack.rb +9 -0
  23. data/games/example/lib/models/combat_update.rb +11 -0
  24. data/games/example/lib/models/player_command.rb +7 -0
  25. data/games/example/lib/models/user.rb +11 -0
  26. data/games/example/lib/models/vitals.rb +17 -0
  27. data/games/example/lib/npc.rb +111 -0
  28. data/games/example/lib/npc_group.rb +42 -0
  29. data/games/example/lib/npc_movement.rb +116 -0
  30. data/games/example/lib/player_manager.rb +58 -0
  31. data/games/example/lib/player_register.rb +80 -0
  32. data/games/example/lib/tracking_handler.rb +17 -0
  33. data/games/example/lib/zone_manager.rb +57 -0
  34. data/games/preload.rb +8 -0
  35. data/integration_tests/basic_spec.rb +68 -0
  36. data/integration_tests/bot_spec.rb +18 -0
  37. data/integration_tests/chat_spec.rb +45 -0
  38. data/integration_tests/distributed_spec.rb +34 -0
  39. data/integration_tests/entity_tracking_spec.rb +48 -0
  40. data/integration_tests/mono_spec.rb +16 -0
  41. data/integration_tests/objectdb_spec.rb +55 -0
  42. data/integration_tests/tcp_client_spec.rb +71 -0
  43. data/integration_tests/udp_client_spec.rb +61 -0
  44. data/integration_tests/udp_spec.rb +20 -0
  45. data/integration_tests/udt_client_spec.rb +23 -0
  46. data/integration_tests/udt_spec.rb +31 -0
  47. data/java/.gitignore +1 -0
  48. data/java/build.gradle +93 -0
  49. data/java/component.erb +396 -0
  50. data/java/gradle.properties +6 -0
  51. data/java/gradle/wrapper/gradle-wrapper.jar +0 -0
  52. data/java/gradle/wrapper/gradle-wrapper.properties +6 -0
  53. data/java/gradlew +164 -0
  54. data/java/gradlew.bat +90 -0
  55. data/java/local_lib/protostuff-compiler-1.0.7-jarjar.jar +0 -0
  56. data/java/settings.gradle +2 -0
  57. data/java/src/main/java/com/game_machine/core/ActorFactory.java +25 -0
  58. data/java/src/main/java/com/game_machine/core/ActorUtil.java +39 -0
  59. data/java/src/main/java/com/game_machine/core/CommandProxy.java +9 -0
  60. data/java/src/main/java/com/game_machine/core/EntitySerializer.java +66 -0
  61. data/java/src/main/java/com/game_machine/core/EventStreamHandler.java +43 -0
  62. data/java/src/main/java/com/game_machine/core/GameMachineLoader.java +25 -0
  63. data/java/src/main/java/com/game_machine/core/Grid.java +195 -0
  64. data/java/src/main/java/com/game_machine/core/GridValue.java +30 -0
  65. data/java/src/main/java/com/game_machine/core/IActorFactory.java +7 -0
  66. data/java/src/main/java/com/game_machine/core/NetMessage.java +28 -0
  67. data/java/src/main/java/com/game_machine/core/UdpServer.java +97 -0
  68. data/java/src/main/java/com/game_machine/core/UdpServerHandler.java +90 -0
  69. data/java/src/main/resources/game_machine.java.stg +738 -0
  70. data/java/src/main/resources/logback.xml +14 -0
  71. data/java/src/main/resources/logging.properties +3 -0
  72. data/java/src/main/resources/protostuff.properties +7 -0
  73. data/lib/game_machine.rb +85 -0
  74. data/lib/game_machine/actor.rb +7 -0
  75. data/lib/game_machine/actor/base.rb +184 -0
  76. data/lib/game_machine/actor/builder.rb +108 -0
  77. data/lib/game_machine/actor/development.rb +31 -0
  78. data/lib/game_machine/actor/factory.rb +35 -0
  79. data/lib/game_machine/actor/mono_actor.rb +89 -0
  80. data/lib/game_machine/actor/ref.rb +81 -0
  81. data/lib/game_machine/actor/reloadable.rb +98 -0
  82. data/lib/game_machine/actor/system.rb +32 -0
  83. data/lib/game_machine/akka.rb +98 -0
  84. data/lib/game_machine/app_config.rb +49 -0
  85. data/lib/game_machine/application.rb +181 -0
  86. data/lib/game_machine/auth_handlers/base.rb +21 -0
  87. data/lib/game_machine/auth_handlers/public.rb +34 -0
  88. data/lib/game_machine/bot/chat.rb +66 -0
  89. data/lib/game_machine/bot/client.rb +54 -0
  90. data/lib/game_machine/client_manager.rb +204 -0
  91. data/lib/game_machine/clients.rb +4 -0
  92. data/lib/game_machine/clients/client.rb +45 -0
  93. data/lib/game_machine/clients/tcp_client.rb +25 -0
  94. data/lib/game_machine/clients/test_client.rb +151 -0
  95. data/lib/game_machine/clients/udp_client.rb +25 -0
  96. data/lib/game_machine/clients/udt_client.rb +34 -0
  97. data/lib/game_machine/cluster_monitor.rb +115 -0
  98. data/lib/game_machine/commands.rb +23 -0
  99. data/lib/game_machine/commands/base.rb +21 -0
  100. data/lib/game_machine/commands/chat_commands.rb +88 -0
  101. data/lib/game_machine/commands/datastore_commands.rb +60 -0
  102. data/lib/game_machine/commands/grid_commands.rb +35 -0
  103. data/lib/game_machine/commands/message_helper.rb +25 -0
  104. data/lib/game_machine/commands/misc_commands.rb +29 -0
  105. data/lib/game_machine/commands/navigation_commands.rb +24 -0
  106. data/lib/game_machine/commands/player_commands.rb +28 -0
  107. data/lib/game_machine/commands/proxy.rb +16 -0
  108. data/lib/game_machine/console.rb +3 -0
  109. data/lib/game_machine/console/build.rb +74 -0
  110. data/lib/game_machine/console/install.rb +92 -0
  111. data/lib/game_machine/console/server.rb +120 -0
  112. data/lib/game_machine/data_store.rb +52 -0
  113. data/lib/game_machine/data_stores/couchbase.rb +18 -0
  114. data/lib/game_machine/data_stores/mapdb.rb +49 -0
  115. data/lib/game_machine/data_stores/memory.rb +35 -0
  116. data/lib/game_machine/data_stores/redis.rb +46 -0
  117. data/lib/game_machine/endpoints.rb +6 -0
  118. data/lib/game_machine/endpoints/mono_gateway.rb +87 -0
  119. data/lib/game_machine/endpoints/tcp.rb +51 -0
  120. data/lib/game_machine/endpoints/tcp_handler.rb +75 -0
  121. data/lib/game_machine/endpoints/udp.rb +88 -0
  122. data/lib/game_machine/endpoints/udp_incoming.rb +113 -0
  123. data/lib/game_machine/endpoints/udp_outgoing.rb +46 -0
  124. data/lib/game_machine/game_loader.rb +46 -0
  125. data/lib/game_machine/game_systems.rb +14 -0
  126. data/lib/game_machine/game_systems/agents/controller.rb +118 -0
  127. data/lib/game_machine/game_systems/chat.rb +256 -0
  128. data/lib/game_machine/game_systems/chat_manager.rb +108 -0
  129. data/lib/game_machine/game_systems/chat_topic.rb +36 -0
  130. data/lib/game_machine/game_systems/devnull.rb +13 -0
  131. data/lib/game_machine/game_systems/entity_loader.rb +12 -0
  132. data/lib/game_machine/game_systems/entity_tracking.rb +133 -0
  133. data/lib/game_machine/game_systems/local_echo.rb +16 -0
  134. data/lib/game_machine/game_systems/objectdb_proxy.rb +61 -0
  135. data/lib/game_machine/game_systems/private_chat.rb +20 -0
  136. data/lib/game_machine/game_systems/region_manager.rb +91 -0
  137. data/lib/game_machine/game_systems/region_service.rb +94 -0
  138. data/lib/game_machine/game_systems/region_settings.rb +13 -0
  139. data/lib/game_machine/game_systems/remote_echo.rb +14 -0
  140. data/lib/game_machine/game_systems/stress_test.rb +21 -0
  141. data/lib/game_machine/grid.rb +60 -0
  142. data/lib/game_machine/grid_replicator.rb +31 -0
  143. data/lib/game_machine/handlers/authentication.rb +55 -0
  144. data/lib/game_machine/handlers/game.rb +63 -0
  145. data/lib/game_machine/handlers/request.rb +80 -0
  146. data/lib/game_machine/hashring.rb +48 -0
  147. data/lib/game_machine/helpers/game_message.rb +159 -0
  148. data/lib/game_machine/helpers/state_machine.rb +29 -0
  149. data/lib/game_machine/java_lib.rb +51 -0
  150. data/lib/game_machine/logger.rb +39 -0
  151. data/lib/game_machine/message_buffer.rb +58 -0
  152. data/lib/game_machine/message_queue.rb +63 -0
  153. data/lib/game_machine/model.rb +125 -0
  154. data/lib/game_machine/models.rb +3 -0
  155. data/lib/game_machine/models/player_status_update.rb +8 -0
  156. data/lib/game_machine/models/region.rb +9 -0
  157. data/lib/game_machine/mono_server.rb +20 -0
  158. data/lib/game_machine/navigation.rb +4 -0
  159. data/lib/game_machine/navigation/detour.rb +20 -0
  160. data/lib/game_machine/navigation/detour_navmesh.rb +53 -0
  161. data/lib/game_machine/navigation/detour_path.rb +53 -0
  162. data/lib/game_machine/navigation/path.rb +31 -0
  163. data/lib/game_machine/object_db.rb +67 -0
  164. data/lib/game_machine/protobuf.rb +6 -0
  165. data/lib/game_machine/protobuf/game_messages.rb +24 -0
  166. data/lib/game_machine/protobuf/generate.rb +113 -0
  167. data/lib/game_machine/protobuf_extensions/entity_helper.rb +11 -0
  168. data/lib/game_machine/reloadable_monitor.rb +26 -0
  169. data/lib/game_machine/restart_watcher.rb +17 -0
  170. data/lib/game_machine/ruby_extensions/nilclass.rb +10 -0
  171. data/lib/game_machine/ruby_extensions/string.rb +17 -0
  172. data/lib/game_machine/scheduler.rb +23 -0
  173. data/lib/game_machine/securerandom.rb +6 -0
  174. data/lib/game_machine/settings.rb +11 -0
  175. data/lib/game_machine/system_monitor.rb +19 -0
  176. data/lib/game_machine/system_stats.rb +24 -0
  177. data/lib/game_machine/uniqueid.rb +23 -0
  178. data/lib/game_machine/vector.rb +95 -0
  179. data/lib/game_machine/version.rb +3 -0
  180. data/lib/game_machine/write_behind_cache.rb +164 -0
  181. data/mono/bin/csharp/common.xslt +109 -0
  182. data/mono/bin/csharp/csharp.xslt +628 -0
  183. data/mono/bin/csharp/descriptor.proto +533 -0
  184. data/mono/bin/csharp/protobuf-net.dll +0 -0
  185. data/mono/bin/csharp/protobuf-net.pdb +0 -0
  186. data/mono/bin/csharp/protobuf-net.xml +2879 -0
  187. data/mono/bin/csharp/protogen.exe.config +3 -0
  188. data/mono/bin/csharp/protogen.pdb +0 -0
  189. data/mono/bin/csharp/protogen_csharp.exe +0 -0
  190. data/mono/bin/csharp/vb.xslt +745 -0
  191. data/mono/bin/csharp/xml.xslt +26 -0
  192. data/mono/server/Makefile +6 -0
  193. data/mono/server/NLog.config +12 -0
  194. data/mono/server/NLog.dll +0 -0
  195. data/mono/server/actor.cs +37 -0
  196. data/mono/server/build.bat +3 -0
  197. data/mono/server/cscompmgd.dll +0 -0
  198. data/mono/server/iactor.cs +11 -0
  199. data/mono/server/message_router.cs +67 -0
  200. data/mono/server/message_util.cs +29 -0
  201. data/mono/server/messages.cs +1888 -0
  202. data/mono/server/protobuf-net.dll +0 -0
  203. data/mono/server/proxy_client.cs +73 -0
  204. data/mono/server/proxy_server.cs +30 -0
  205. data/mono/server/test_actor.cs +33 -0
  206. data/pathfinding/bin/premake4 +0 -0
  207. data/pathfinding/include/mesh_loader.h +28 -0
  208. data/pathfinding/include/pathfind.h +167 -0
  209. data/pathfinding/main.cpp +39 -0
  210. data/pathfinding/mesh_loader.cpp +108 -0
  211. data/pathfinding/pathfind.cpp +174 -0
  212. data/pathfinding/pathfinder.cs +66 -0
  213. data/pathfinding/premake4.lua +109 -0
  214. data/script/server.sh +109 -0
  215. data/script/watch.sh +11 -0
  216. data/spec/actor/actor_spec.rb +73 -0
  217. data/spec/actor/builder_spec.rb +56 -0
  218. data/spec/actor/ref_spec.rb +83 -0
  219. data/spec/application_spec.rb +7 -0
  220. data/spec/client_manager_spec.rb +171 -0
  221. data/spec/commands/chat_commands_spec.rb +38 -0
  222. data/spec/commands/datastore_commands_spec.rb +91 -0
  223. data/spec/commands/grid_commands_spec.rb +37 -0
  224. data/spec/commands/navigation_commands_spec.rb +51 -0
  225. data/spec/commands/player_commands_spec.rb +48 -0
  226. data/spec/commands_spec.rb +38 -0
  227. data/spec/data_stores/mapdb_spec.rb +46 -0
  228. data/spec/data_stores/redis_spec.rb +44 -0
  229. data/spec/game_systems/agents/controller_spec.rb +84 -0
  230. data/spec/game_systems/agents/test_agent.rb +10 -0
  231. data/spec/game_systems/agents/test_agent_config.rb +29 -0
  232. data/spec/game_systems/chat_manager_spec.rb +66 -0
  233. data/spec/game_systems/chat_spec.rb +187 -0
  234. data/spec/game_systems/entity_tracking_spec.rb +64 -0
  235. data/spec/game_systems/region_manager_spec.rb +138 -0
  236. data/spec/grid_spec.rb +37 -0
  237. data/spec/handlers/authentication_spec.rb +36 -0
  238. data/spec/handlers/game_spec.rb +49 -0
  239. data/spec/handlers/request_spec.rb +65 -0
  240. data/spec/hashring_spec.rb +59 -0
  241. data/spec/integration_helper.rb +120 -0
  242. data/spec/java_grid_spec.rb +89 -0
  243. data/spec/message_buffer_spec.rb +67 -0
  244. data/spec/message_expectations.rb +47 -0
  245. data/spec/message_queue_spec.rb +23 -0
  246. data/spec/misc_spec.rb +71 -0
  247. data/spec/model_spec.rb +103 -0
  248. data/spec/mono_spec.rb +36 -0
  249. data/spec/mono_test.rb +18 -0
  250. data/spec/navigation/detour_navmesh_spec.rb +34 -0
  251. data/spec/navigation/detour_path_spec.rb +25 -0
  252. data/spec/spec_helper.rb +40 -0
  253. data/spec/udp_server_spec.rb +10 -0
  254. data/spec/write_behind_cache_spec.rb +109 -0
  255. data/web/app.rb +131 -0
  256. data/web/config/trinidad.yml +4 -0
  257. data/web/controllers/auth_controller.rb +19 -0
  258. data/web/controllers/base_controller.rb +16 -0
  259. data/web/controllers/index_controller.rb +7 -0
  260. data/web/controllers/log_controller.rb +47 -0
  261. data/web/controllers/messages_controller.rb +59 -0
  262. data/web/controllers/player_register_controller.rb +15 -0
  263. data/web/log/development.log +1339 -0
  264. data/web/tmp/restart.txt +0 -0
  265. data/web/views/game_messages.haml +45 -0
  266. data/web/views/index.haml +6 -0
  267. data/web/views/layout.haml +41 -0
  268. data/web/views/logs.haml +32 -0
  269. data/web/views/player_register.haml +22 -0
  270. data/web/views/player_registered.haml +2 -0
  271. data/web/views/register_layout.haml +22 -0
  272. data/web/views/restart.haml +35 -0
  273. metadata +576 -0
@@ -0,0 +1,533 @@
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // http://code.google.com/p/protobuf/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // The messages in this file describe the definitions found in .proto files.
36
+ // A valid .proto file can be translated directly to a FileDescriptorProto
37
+ // without any other information (e.g. without reading its imports).
38
+
39
+
40
+
41
+ package google.protobuf;
42
+ option java_package = "com.google.protobuf";
43
+ option java_outer_classname = "DescriptorProtos";
44
+
45
+ // descriptor.proto must be optimized for speed because reflection-based
46
+ // algorithms don't work during bootstrapping.
47
+ option optimize_for = SPEED;
48
+
49
+ // The protocol compiler can output a FileDescriptorSet containing the .proto
50
+ // files it parses.
51
+ message FileDescriptorSet {
52
+ repeated FileDescriptorProto file = 1;
53
+ }
54
+
55
+ // Describes a complete .proto file.
56
+ message FileDescriptorProto {
57
+ optional string name = 1; // file name, relative to root of source tree
58
+ optional string package = 2; // e.g. "foo", "foo.bar", etc.
59
+
60
+ // Names of files imported by this file.
61
+ repeated string dependency = 3;
62
+
63
+ // All top-level definitions in this file.
64
+ repeated DescriptorProto message_type = 4;
65
+ repeated EnumDescriptorProto enum_type = 5;
66
+ repeated ServiceDescriptorProto service = 6;
67
+ repeated FieldDescriptorProto extension = 7;
68
+
69
+ optional FileOptions options = 8;
70
+
71
+ // This field contains optional information about the original source code.
72
+ // You may safely remove this entire field whithout harming runtime
73
+ // functionality of the descriptors -- the information is needed only by
74
+ // development tools.
75
+ optional SourceCodeInfo source_code_info = 9;
76
+ }
77
+
78
+ // Describes a message type.
79
+ message DescriptorProto {
80
+ optional string name = 1;
81
+
82
+ repeated FieldDescriptorProto field = 2;
83
+ repeated FieldDescriptorProto extension = 6;
84
+
85
+ repeated DescriptorProto nested_type = 3;
86
+ repeated EnumDescriptorProto enum_type = 4;
87
+
88
+ message ExtensionRange {
89
+ optional int32 start = 1;
90
+ optional int32 end = 2;
91
+ }
92
+ repeated ExtensionRange extension_range = 5;
93
+
94
+ optional MessageOptions options = 7;
95
+ }
96
+
97
+ // Describes a field within a message.
98
+ message FieldDescriptorProto {
99
+ enum Type {
100
+ // 0 is reserved for errors.
101
+ // Order is weird for historical reasons.
102
+ TYPE_DOUBLE = 1;
103
+ TYPE_FLOAT = 2;
104
+ TYPE_INT64 = 3; // Not ZigZag encoded. Negative numbers
105
+ // take 10 bytes. Use TYPE_SINT64 if negative
106
+ // values are likely.
107
+ TYPE_UINT64 = 4;
108
+ TYPE_INT32 = 5; // Not ZigZag encoded. Negative numbers
109
+ // take 10 bytes. Use TYPE_SINT32 if negative
110
+ // values are likely.
111
+ TYPE_FIXED64 = 6;
112
+ TYPE_FIXED32 = 7;
113
+ TYPE_BOOL = 8;
114
+ TYPE_STRING = 9;
115
+ TYPE_GROUP = 10; // Tag-delimited aggregate.
116
+ TYPE_MESSAGE = 11; // Length-delimited aggregate.
117
+
118
+ // New in version 2.
119
+ TYPE_BYTES = 12;
120
+ TYPE_UINT32 = 13;
121
+ TYPE_ENUM = 14;
122
+ TYPE_SFIXED32 = 15;
123
+ TYPE_SFIXED64 = 16;
124
+ TYPE_SINT32 = 17; // Uses ZigZag encoding.
125
+ TYPE_SINT64 = 18; // Uses ZigZag encoding.
126
+ };
127
+
128
+ enum Label {
129
+ // 0 is reserved for errors
130
+ LABEL_OPTIONAL = 1;
131
+ LABEL_REQUIRED = 2;
132
+ LABEL_REPEATED = 3;
133
+ // TODO(sanjay): Should we add LABEL_MAP?
134
+ };
135
+
136
+ optional string name = 1;
137
+ optional int32 number = 3;
138
+ optional Label label = 4;
139
+
140
+ // If type_name is set, this need not be set. If both this and type_name
141
+ // are set, this must be either TYPE_ENUM or TYPE_MESSAGE.
142
+ optional Type type = 5;
143
+
144
+ // For message and enum types, this is the name of the type. If the name
145
+ // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
146
+ // rules are used to find the type (i.e. first the nested types within this
147
+ // message are searched, then within the parent, on up to the root
148
+ // namespace).
149
+ optional string type_name = 6;
150
+
151
+ // For extensions, this is the name of the type being extended. It is
152
+ // resolved in the same manner as type_name.
153
+ optional string extendee = 2;
154
+
155
+ // For numeric types, contains the original text representation of the value.
156
+ // For booleans, "true" or "false".
157
+ // For strings, contains the default text contents (not escaped in any way).
158
+ // For bytes, contains the C escaped value. All bytes >= 128 are escaped.
159
+ // TODO(kenton): Base-64 encode?
160
+ optional string default_value = 7;
161
+
162
+ optional FieldOptions options = 8;
163
+ }
164
+
165
+ // Describes an enum type.
166
+ message EnumDescriptorProto {
167
+ optional string name = 1;
168
+
169
+ repeated EnumValueDescriptorProto value = 2;
170
+
171
+ optional EnumOptions options = 3;
172
+ }
173
+
174
+ // Describes a value within an enum.
175
+ message EnumValueDescriptorProto {
176
+ optional string name = 1;
177
+ optional int32 number = 2;
178
+
179
+ optional EnumValueOptions options = 3;
180
+ }
181
+
182
+ // Describes a service.
183
+ message ServiceDescriptorProto {
184
+ optional string name = 1;
185
+ repeated MethodDescriptorProto method = 2;
186
+
187
+ optional ServiceOptions options = 3;
188
+ }
189
+
190
+ // Describes a method of a service.
191
+ message MethodDescriptorProto {
192
+ optional string name = 1;
193
+
194
+ // Input and output type names. These are resolved in the same way as
195
+ // FieldDescriptorProto.type_name, but must refer to a message type.
196
+ optional string input_type = 2;
197
+ optional string output_type = 3;
198
+
199
+ optional MethodOptions options = 4;
200
+ }
201
+
202
+ // ===================================================================
203
+ // Options
204
+
205
+ // Each of the definitions above may have "options" attached. These are
206
+ // just annotations which may cause code to be generated slightly differently
207
+ // or may contain hints for code that manipulates protocol messages.
208
+ //
209
+ // Clients may define custom options as extensions of the *Options messages.
210
+ // These extensions may not yet be known at parsing time, so the parser cannot
211
+ // store the values in them. Instead it stores them in a field in the *Options
212
+ // message called uninterpreted_option. This field must have the same name
213
+ // across all *Options messages. We then use this field to populate the
214
+ // extensions when we build a descriptor, at which point all protos have been
215
+ // parsed and so all extensions are known.
216
+ //
217
+ // Extension numbers for custom options may be chosen as follows:
218
+ // * For options which will only be used within a single application or
219
+ // organization, or for experimental options, use field numbers 50000
220
+ // through 99999. It is up to you to ensure that you do not use the
221
+ // same number for multiple options.
222
+ // * For options which will be published and used publicly by multiple
223
+ // independent entities, e-mail kenton@google.com to reserve extension
224
+ // numbers. Simply tell me how many you need and I'll send you back a
225
+ // set of numbers to use -- there's no need to explain how you intend to
226
+ // use them. If this turns out to be popular, a web service will be set up
227
+ // to automatically assign option numbers.
228
+
229
+
230
+ message FileOptions {
231
+
232
+ // Sets the Java package where classes generated from this .proto will be
233
+ // placed. By default, the proto package is used, but this is often
234
+ // inappropriate because proto packages do not normally start with backwards
235
+ // domain names.
236
+ optional string java_package = 1;
237
+
238
+
239
+ // If set, all the classes from the .proto file are wrapped in a single
240
+ // outer class with the given name. This applies to both Proto1
241
+ // (equivalent to the old "--one_java_file" option) and Proto2 (where
242
+ // a .proto always translates to a single class, but you may want to
243
+ // explicitly choose the class name).
244
+ optional string java_outer_classname = 8;
245
+
246
+ // If set true, then the Java code generator will generate a separate .java
247
+ // file for each top-level message, enum, and service defined in the .proto
248
+ // file. Thus, these types will *not* be nested inside the outer class
249
+ // named by java_outer_classname. However, the outer class will still be
250
+ // generated to contain the file's getDescriptor() method as well as any
251
+ // top-level extensions defined in the file.
252
+ optional bool java_multiple_files = 10 [default=false];
253
+
254
+ // If set true, then the Java code generator will generate equals() and
255
+ // hashCode() methods for all messages defined in the .proto file. This is
256
+ // purely a speed optimization, as the AbstractMessage base class includes
257
+ // reflection-based implementations of these methods.
258
+ optional bool java_generate_equals_and_hash = 20 [default=false];
259
+
260
+ // Generated classes can be optimized for speed or code size.
261
+ enum OptimizeMode {
262
+ SPEED = 1; // Generate complete code for parsing, serialization,
263
+ // etc.
264
+ CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
265
+ LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
266
+ }
267
+ optional OptimizeMode optimize_for = 9 [default=SPEED];
268
+
269
+
270
+
271
+
272
+ // Should generic services be generated in each language? "Generic" services
273
+ // are not specific to any particular RPC system. They are generated by the
274
+ // main code generators in each language (without additional plugins).
275
+ // Generic services were the only kind of service generation supported by
276
+ // early versions of proto2.
277
+ //
278
+ // Generic services are now considered deprecated in favor of using plugins
279
+ // that generate code specific to your particular RPC system. Therefore,
280
+ // these default to false. Old code which depends on generic services should
281
+ // explicitly set them to true.
282
+ optional bool cc_generic_services = 16 [default=false];
283
+ optional bool java_generic_services = 17 [default=false];
284
+ optional bool py_generic_services = 18 [default=false];
285
+
286
+ // The parser stores options it doesn't recognize here. See above.
287
+ repeated UninterpretedOption uninterpreted_option = 999;
288
+
289
+ // Clients can define custom options in extensions of this message. See above.
290
+ extensions 1000 to max;
291
+ }
292
+
293
+ message MessageOptions {
294
+ // Set true to use the old proto1 MessageSet wire format for extensions.
295
+ // This is provided for backwards-compatibility with the MessageSet wire
296
+ // format. You should not use this for any other reason: It's less
297
+ // efficient, has fewer features, and is more complicated.
298
+ //
299
+ // The message must be defined exactly as follows:
300
+ // message Foo {
301
+ // option message_set_wire_format = true;
302
+ // extensions 4 to max;
303
+ // }
304
+ // Note that the message cannot have any defined fields; MessageSets only
305
+ // have extensions.
306
+ //
307
+ // All extensions of your type must be singular messages; e.g. they cannot
308
+ // be int32s, enums, or repeated messages.
309
+ //
310
+ // Because this is an option, the above two restrictions are not enforced by
311
+ // the protocol compiler.
312
+ optional bool message_set_wire_format = 1 [default=false];
313
+
314
+ // Disables the generation of the standard "descriptor()" accessor, which can
315
+ // conflict with a field of the same name. This is meant to make migration
316
+ // from proto1 easier; new code should avoid fields named "descriptor".
317
+ optional bool no_standard_descriptor_accessor = 2 [default=false];
318
+
319
+ // The parser stores options it doesn't recognize here. See above.
320
+ repeated UninterpretedOption uninterpreted_option = 999;
321
+
322
+ // Clients can define custom options in extensions of this message. See above.
323
+ extensions 1000 to max;
324
+ }
325
+
326
+ message FieldOptions {
327
+ // The ctype option instructs the C++ code generator to use a different
328
+ // representation of the field than it normally would. See the specific
329
+ // options below. This option is not yet implemented in the open source
330
+ // release -- sorry, we'll try to include it in a future version!
331
+ optional CType ctype = 1 [default = STRING];
332
+ enum CType {
333
+ // Default mode.
334
+ STRING = 0;
335
+
336
+ CORD = 1;
337
+
338
+ STRING_PIECE = 2;
339
+ }
340
+ // The packed option can be enabled for repeated primitive fields to enable
341
+ // a more efficient representation on the wire. Rather than repeatedly
342
+ // writing the tag and type for each element, the entire array is encoded as
343
+ // a single length-delimited blob.
344
+ optional bool packed = 2;
345
+
346
+
347
+ // Is this field deprecated?
348
+ // Depending on the target platform, this can emit Deprecated annotations
349
+ // for accessors, or it will be completely ignored; in the very least, this
350
+ // is a formalization for deprecating fields.
351
+ optional bool deprecated = 3 [default=false];
352
+
353
+ // EXPERIMENTAL. DO NOT USE.
354
+ // For "map" fields, the name of the field in the enclosed type that
355
+ // is the key for this map. For example, suppose we have:
356
+ // message Item {
357
+ // required string name = 1;
358
+ // required string value = 2;
359
+ // }
360
+ // message Config {
361
+ // repeated Item items = 1 [experimental_map_key="name"];
362
+ // }
363
+ // In this situation, the map key for Item will be set to "name".
364
+ // TODO: Fully-implement this, then remove the "experimental_" prefix.
365
+ optional string experimental_map_key = 9;
366
+
367
+ // The parser stores options it doesn't recognize here. See above.
368
+ repeated UninterpretedOption uninterpreted_option = 999;
369
+
370
+ // Clients can define custom options in extensions of this message. See above.
371
+ extensions 1000 to max;
372
+ }
373
+
374
+ message EnumOptions {
375
+
376
+ // The parser stores options it doesn't recognize here. See above.
377
+ repeated UninterpretedOption uninterpreted_option = 999;
378
+
379
+ // Clients can define custom options in extensions of this message. See above.
380
+ extensions 1000 to max;
381
+ }
382
+
383
+ message EnumValueOptions {
384
+ // The parser stores options it doesn't recognize here. See above.
385
+ repeated UninterpretedOption uninterpreted_option = 999;
386
+
387
+ // Clients can define custom options in extensions of this message. See above.
388
+ extensions 1000 to max;
389
+ }
390
+
391
+ message ServiceOptions {
392
+
393
+ // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
394
+ // framework. We apologize for hoarding these numbers to ourselves, but
395
+ // we were already using them long before we decided to release Protocol
396
+ // Buffers.
397
+
398
+ // The parser stores options it doesn't recognize here. See above.
399
+ repeated UninterpretedOption uninterpreted_option = 999;
400
+
401
+ // Clients can define custom options in extensions of this message. See above.
402
+ extensions 1000 to max;
403
+ }
404
+
405
+ message MethodOptions {
406
+
407
+ // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
408
+ // framework. We apologize for hoarding these numbers to ourselves, but
409
+ // we were already using them long before we decided to release Protocol
410
+ // Buffers.
411
+
412
+ // The parser stores options it doesn't recognize here. See above.
413
+ repeated UninterpretedOption uninterpreted_option = 999;
414
+
415
+ // Clients can define custom options in extensions of this message. See above.
416
+ extensions 1000 to max;
417
+ }
418
+
419
+ // A message representing a option the parser does not recognize. This only
420
+ // appears in options protos created by the compiler::Parser class.
421
+ // DescriptorPool resolves these when building Descriptor objects. Therefore,
422
+ // options protos in descriptor objects (e.g. returned by Descriptor::options(),
423
+ // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
424
+ // in them.
425
+ message UninterpretedOption {
426
+ // The name of the uninterpreted option. Each string represents a segment in
427
+ // a dot-separated name. is_extension is true iff a segment represents an
428
+ // extension (denoted with parentheses in options specs in .proto files).
429
+ // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
430
+ // "foo.(bar.baz).qux".
431
+ message NamePart {
432
+ required string name_part = 1;
433
+ required bool is_extension = 2;
434
+ }
435
+ repeated NamePart name = 2;
436
+
437
+ // The value of the uninterpreted option, in whatever type the tokenizer
438
+ // identified it as during parsing. Exactly one of these should be set.
439
+ optional string identifier_value = 3;
440
+ optional uint64 positive_int_value = 4;
441
+ optional int64 negative_int_value = 5;
442
+ optional double double_value = 6;
443
+ optional bytes string_value = 7;
444
+ optional string aggregate_value = 8;
445
+ }
446
+
447
+ // ===================================================================
448
+ // Optional source code info
449
+
450
+ // Encapsulates information about the original source file from which a
451
+ // FileDescriptorProto was generated.
452
+ message SourceCodeInfo {
453
+ // A Location identifies a piece of source code in a .proto file which
454
+ // corresponds to a particular definition. This information is intended
455
+ // to be useful to IDEs, code indexers, documentation generators, and similar
456
+ // tools.
457
+ //
458
+ // For example, say we have a file like:
459
+ // message Foo {
460
+ // optional string foo = 1;
461
+ // }
462
+ // Let's look at just the field definition:
463
+ // optional string foo = 1;
464
+ // ^ ^^ ^^ ^ ^^^
465
+ // a bc de f ghi
466
+ // We have the following locations:
467
+ // span path represents
468
+ // [a,i) [ 4, 0, 2, 0 ] The whole field definition.
469
+ // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
470
+ // [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
471
+ // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
472
+ // [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
473
+ //
474
+ // Notes:
475
+ // - A location may refer to a repeated field itself (i.e. not to any
476
+ // particular index within it). This is used whenever a set of elements are
477
+ // logically enclosed in a single code segment. For example, an entire
478
+ // extend block (possibly containing multiple extension definitions) will
479
+ // have an outer location whose path refers to the "extensions" repeated
480
+ // field without an index.
481
+ // - Multiple locations may have the same path. This happens when a single
482
+ // logical declaration is spread out across multiple places. The most
483
+ // obvious example is the "extend" block again -- there may be multiple
484
+ // extend blocks in the same scope, each of which will have the same path.
485
+ // - A location's span is not always a subset of its parent's span. For
486
+ // example, the "extendee" of an extension declaration appears at the
487
+ // beginning of the "extend" block and is shared by all extensions within
488
+ // the block.
489
+ // - Just because a location's span is a subset of some other location's span
490
+ // does not mean that it is a descendent. For example, a "group" defines
491
+ // both a type and a field in a single declaration. Thus, the locations
492
+ // corresponding to the type and field and their components will overlap.
493
+ // - Code which tries to interpret locations should probably be designed to
494
+ // ignore those that it doesn't understand, as more types of locations could
495
+ // be recorded in the future.
496
+ repeated Location location = 1;
497
+ message Location {
498
+ // Identifies which part of the FileDescriptorProto was defined at this
499
+ // location.
500
+ //
501
+ // Each element is a field number or an index. They form a path from
502
+ // the root FileDescriptorProto to the place where the definition. For
503
+ // example, this path:
504
+ // [ 4, 3, 2, 7, 1 ]
505
+ // refers to:
506
+ // file.message_type(3) // 4, 3
507
+ // .field(7) // 2, 7
508
+ // .name() // 1
509
+ // This is because FileDescriptorProto.message_type has field number 4:
510
+ // repeated DescriptorProto message_type = 4;
511
+ // and DescriptorProto.field has field number 2:
512
+ // repeated FieldDescriptorProto field = 2;
513
+ // and FieldDescriptorProto.name has field number 1:
514
+ // optional string name = 1;
515
+ //
516
+ // Thus, the above path gives the location of a field name. If we removed
517
+ // the last element:
518
+ // [ 4, 3, 2, 7 ]
519
+ // this path refers to the whole field declaration (from the beginning
520
+ // of the label to the terminating semicolon).
521
+ repeated int32 path = 1 [packed=true];
522
+
523
+ // Always has exactly three or four elements: start line, start column,
524
+ // end line (optional, otherwise assumed same as start line), end column.
525
+ // These are packed into a single field for efficiency. Note that line
526
+ // and column numbers are zero-based -- typically you will want to add
527
+ // 1 to each before displaying to a user.
528
+ repeated int32 span = 2 [packed=true];
529
+
530
+ // TODO(kenton): Record comments appearing before and after the
531
+ // declaration.
532
+ }
533
+ }