Compare commits

...

7 Commits

10 changed files with 88 additions and 472 deletions

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -3,21 +3,38 @@
请使用下面的联系方式和我们联系: 请使用下面的联系方式和我们联系:
| 联系方式名称 | 联系方式 | | 联系方式名称 | 联系方式 |
|---|---| |--------|-----------------------------------------------|
| 电子邮件 | [service@ossez.com](mailto:service@ossez.com) | | 电子邮件 | [service@ossez.com](mailto:service@ossez.com) |
| QQ 或微信 | 103899765 | | QQ 或微信 | 103899765 |
| QQ 交流群 | 15186112 | | 社区论坛 | https://www.ossez.com/c/open-source/java/15 |
| 社区论坛 | [https://www.ossez.com/](https://www.ossez.com/) |
| WIKI 维基 | [https://www.cwiki.us/](https://www.cwiki.us/) |
| CN 博客 | [https://www.cwikius.cn/](https://www.cwikius.cn/) |
## 公众平台 # 公众平台
我们建议您通过社区论坛来和我们进行沟通,请关注我们公众平台上的账号
我们建议您通过社区论坛来和我们进行沟通,请关注我们公众平台上的账号。
扫描 QR 关注我们的微信公众号和头条号。
## 微信公众号 ## 微信公众号
![](https://cdn.ossez.com/img/cwikius/cwikius-qr-wechat-search-w400.png) ![](https://cdn.ossez.com/img/cwikius/cwikius-qr-wechat-search-w400.png)
## 头条号 ## 头条号
我们也在头条号上创建了我们的公众号,请扫描下面的 QR 关注我们的头条号。
![](https://cdn.ossez.com/img/cwikius/cwikus-qr-toutiao.png) ![](https://cdn.ossez.com/img/cwikius/cwikus-qr-toutiao.png)
## 知乎
请关注我们的知乎https://www.zhihu.com/people/huyuchengus
## 快速导航
在下面的表格中,我们列出了一些比较有用的 CWIKIUS 相关软件开发使用教程的导航,欢迎访问下面的链接获得更多的内容和参与讨论
| 网站名称 | URL | NOTE |
|----------------|--------------------------------------------------------|----------------------------|
| OSSEZ 社区 | [www.ossez.com](https://www.ossez.com/) | 开放社区,欢迎注册参与讨论 |
| WIKI 维基 | [www.cwiki.us](https://www.cwiki.us/) | 使用 Confluence 部署的 WIKI 知识库 |
| DOCS.OSSEZ.COM | [https://docs.ossez.com/#/](https://docs.ossez.com/#/) | 本手册的编译版本将会部署在这个链接上 |
| CN 博客 | [http://www.cwikius.cn/](http://www.cwikius.cn/) | CWIKIUS.CN 一个有独立思考和温度的清新站 |
##

214
LICENSE
View File

@ -1,201 +1,21 @@
Apache License MIT License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION Copyright (c) 2022 OSSEZ.COM
1. Definitions. Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
"License" shall mean the terms and conditions for use, reproduction, The above copyright notice and this permission notice shall be included in all
and distribution as defined by Sections 1 through 9 of this document. copies or substantial portions of the Software.
"Licensor" shall mean the copyright owner or entity authorized by THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
the copyright owner that is granting the License. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
"Legal Entity" shall mean the union of the acting entity and all AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
other entities that control, are controlled by, or are under common LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
control with that entity. For the purposes of this definition, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
"control" means (i) the power, direct or indirect, to cause the SOFTWARE.
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,10 +1,37 @@
# CWIKIUS 文档和手册 # CWIKIUS 文档和手册
欢迎来到 CWIKIUS 文档和手册的空间 欢迎来到 CWIKIUS 文档和手册的空间
GitHub 上有关 CWIKIUS 的项目:[https://github.com/cwiki-us-docs/cwikius-docs](https://github.com/cwiki-us-docs/cwikius-docs) GitHub 上有关 CWIKIUS 的项目:[https://src.ossez.com/honeymoose/Framework-Docsify](https://src.ossez.com/honeymoose/Framework-Docsify)
[联系我们](CONTACT.md ':include') [联系我们](CONTACT.md ':include')
## 如何本地运行
本项目使用 docsify 进行构建。
### 安装 docsify
如果你的本地计算机中没有安装 docsify 请运行命令行 `npm i docsify-cli -g` 来进行安装。
### 版本检查
运行命令 `docsify -version` 来进行版本和环境检查,如果你能看到下面的内容,则说明已经安装成功了。
```text
docsify-cli version:
4.4.3
```
### 本地运行 docsify
在你的本地计算机终端中运行命令 `docsify serve ./` 后,你的控制台将会看到有余下的输出:
```text
PS D:\WorkDir\Repository\honeymoose\Framework-Docsify> docsify serve ./
Serving D:\WorkDir\Repository\honeymoose\Framework-Docsify now.
Listening at http://localhost:3000
```
访问使用的默认端口是 3000随后你可以通过浏览器进行访问。
## CWIKIUS 文档和手册快速导航 ## CWIKIUS 文档和手册快速导航
在下面的表格中,我们列出了一些比较有用的 CWIKIUS 相关软件开发使用教程的导航,在我们文档的整理中,也参考了一些这些文档。 在下面的表格中,我们列出了一些比较有用的 CWIKIUS 相关软件开发使用教程的导航,在我们文档的整理中,也参考了一些这些文档。

View File

@ -10,7 +10,6 @@
- 其他小工具 - 其他小工具
- [JWT](jwt/README.md) - [JWT](jwt/README.md)
- [MessagePack](message-pack/index.md) - [MessagePack](message-pack/index.md)
- [Protocol Buffers](protocol-buffers/index.md)
- [Discourse](discourse/index.md) - [Discourse](discourse/index.md)
- 面试和算法 - 面试和算法

View File

@ -16,14 +16,26 @@
<meta name="description" content="Description"> <meta name="description" content="Description">
<meta name="viewport" <meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css"> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple.css">
<style>
:root {
/* Reduce the font size */
/* --base-font-size: 14px; */
/* Change the theme color hue (0-360) */
/* --theme-hue: 325; */
/* Add sidebar navigation bullets */
/* --sidebar-nav-link-before-content-l1: "😀"; */
/* --sidebar-nav-link-before-content-l2: "💩"; */
--link-color: var(--theme-color);
}
</style>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script> <script>
window.$docsify = { window.$docsify = {
name: 'CWIKIUS 文档手册', name: 'CWIKIUS 文档手册 模板',
repo: 'https://github.com/cwiki-us-docs/cwikius-docs', repo: 'https://src.ossez.com/honeymoose/Framework-Docsify',
executeScript: true, executeScript: true,
loadNavbar: true, loadNavbar: true,
mergeNavbar: true, mergeNavbar: true,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

View File

@ -1,221 +0,0 @@
# Protocol Buffers 文档
Protocol Buffers 相关文档的内容。
![protocol-buffers-logo](_images/protocol-buffers-logo.jpg)
## Protocol Buffers 简介
如果你在互联网上搜索的话,你可能会看到下面的说明文字。
Google Protocol Buffer( 简称 Protobuf) 是 Google 公司内部的混合语言数据标准,目前已经正在使用的有超过 48,162 种报文格式定义和超过 12,183 个 .proto 文件。
他们用于 RPC 系统和持续数据存储系统。
Protocol Buffers 是一种轻便高效的结构化数据存储格式,可以用于结构化数据串行化,或者说序列化。
它很适合做数据存储或 RPC 数据交换格式。可用于通讯协议、数据存储等领域的语言无关、平台无关、可扩展的序列化结构数据格式。
目前提供了 C++、Java、Python 三种语言的 API。
我们是在实际的数据处理的时候,需要使用 JSON 来序列化数据,但是又考虑到 JSON 在传输的时候数据过大,同时还有很多并不需要的垃圾文件。
我们才考虑到了 Protocol Buffer 提供的功能。
![protocol-buffers-serialization](_images/protocol-buffers-serialization.png)
# Protocol Buffers 开发者指南
欢迎来到 protocol buffers 的开发者指南。protocol buffers 是一个语言中立,平台中立针对通讯协议,数据存储和其他领域中对结构化数据进行序列化的扩展方法。
本文档主要针对的是 JavaC++ 或 Python 的开发人员希望在开发的应用程序中使用 Protocol Buffers。这个有关 Protocol Buffers 摘要性的介绍将会告诉你如何开始使用 Protocol Buffers。
如果你希望更加深入的了解有关 Protocol Buffers 的内容,你可以进入 tutorials 或者 protocol buffer encoding 页面来详细了解。
有关 API 的参考文档请参考页面reference documentation 这里提供了所有这 3 种语言的参考,同时也针对 .proto language 和 style 提供相关的指南。
## 什么是 Protocol Buffers
Protocol buffers 是对结构化数据序列化的一个灵活,高效,自动化工具 —— 你可以将 Protocol buffers 想象成 XML但是体积更小更快也更加简单。
你可以自己定义你的结构化数据,然后你可以使用特定的代码生成工具来非常容易对你的结构化数据进行读取和写入。这些数据的读取和写入可以是一系列的数据流和使用不同的计算机程序语言。
你甚至可以在不对已经部署的程序进行破坏的情况下更新你的数据结构。
## Protocol Buffers 是如何进行工作的
你需要制定你希望如何将你的数据进行序列化。你是通过 proto 文件来定义你的消息结构化数据的。
每一 protocol buffer message 是一个小的信息记录逻辑,这个消息中包含有一系列的名字,变量对照序列。
下面是一些基本的.proto 文件,这些文件中定义了一个消息,这个消息包含有一个 person 信息:
```
message Person {
required string name = 1;
required int32 id = 2;
optional string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
required string number = 1;
optional PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phone = 4;
}
```
通过上面你可以看到这个消息的格式非常简单—— 每一个消息类型都有一个或者多个唯一进行编号的字段,每一个字段包含有一个名字和变量类型。
变量可以为数字整形或者浮点型numbers布尔类型booleans字符串strings原生二进制raw bytes甚至其他的 protocol buffer 消息类型,能够允许你分级的结构化你的数据。
你可以将字段指定为可选字段optional fields必须字段required fields和重复字段repeated fields。你可以从下面的 Protocol Buffer Language Guide 页面中找到更多有关 .proto 的定义。
一旦你成功定义了你的消息,你可以针对你使用的语言使用你定义的 .proto 来运行 protocol buffer 编译器protocol buffer compiler来生成数据访问类。
针对每一个字段,在数据访问类中提供了简单的访问方法(例如 name() 和 set_name())和序列化到原生 2 进制数据和从原生 2 进制数据反序列化的方法。
针对上面的定义,如果你现在使用的是 C++ 语言的话,当你把消息定义进行编译后,你将会得到一个称为 Person 的类。对数据进行序列化和从序列化的数据中protocol buffer 消息)重新获得 Person 数据。
然后你可以写一些类似 Person person; 的代码。
```cpp
Person person;
person.set_name("John Doe");
person.set_id(1234);
person.set_email("jdoe@example.com");
fstream output("myfile", ios::out | ios::binary);
person.SerializeToOstream(&output);
```
随后,你可以对消息进行读取:
```cpp
fstream input("myfile", ios::in | ios::binary);
Person person;
person.ParseFromIstream(&input);
cout << "Name: " << person.name() << endl;
cout << "E-mail: " << person.email() << endl;
```
你可以向你的消息中添加新的字段而不会损坏老的消息。这是因为在老的消息处理中,针对新的字段是完全忽略掉的。因此,如果你在你的通讯协议中使用 protocol buffers 为数据结构的话,
你可以对你的协议和消息进行扩展而不需要担心老的代码没有办法编译通过,或者损坏老的代码。
你可以访问 API Reference section 页面中的内容来了解完整 protocol buffer 代码的生成和使用。
你也可以在 Protocol Buffer Encoding 页面中了解更多protocol buffer 消息是如何进行编码的。
## 为什么不使用 XML
针对 XML 来说 Protocol Buffers 具有更多的优势来对序列化结构数据。
* 更加简单
* 小于 XML 3 到 10 倍
* 快于 XML 20 到 100 倍
* 松耦合
* 使用程序工具来创建数据访问类,使数访问类更加简单
* 假设,你需要讲 person 这个数据进行定义,在 XML 你需要使用:
```xml
<person>
<name>John Doe</name>
<email>jdoe@example.com</email>
</person>
```
来进行定义。
在 Protocol Buffers 中针对上面的消息文本化text format后显示为
```
# Textual representation of a protocol buffer.
# This is *not* the binary format used on the wire.
person {
name: "John Doe"
email: "jdoe@example.com"
}
```
当上面的消息被编码为 Protocol Buffer 二进制格式binary format上面的文字可能小于 28 bytes并且可能需要 100-200 纳秒nanoseconds来进行处理。
我们将上面转换为可以人为读取的目的主要是为进行调试和编辑。
如果你使用 XML 的话,上面的信息至少需要 69 bytes (你需要删除所有的空格),同时你需要 5,000-10,000 纳秒nanoseconds来进行处理。
同时,对 protocol buffer 进行操作也是非常容易的:
```cpp
cout << "Name: " << person.name() << endl;
cout << "E-mail: " << person.email() << endl;
```
如果使用的是 XML 的话,你需要进行下面的操作:
```cpp
cout << "Name: "
<< person.getElementsByTagName("name")->item(0)->innerText()
<< endl;
cout << "E-mail: "
<< person.getElementsByTagName("email")->item(0)->innerText()
<< endl;
```
但是protocol buffers 并不是任何时候都会比 XML 好。例如针对基于文本的标记语言例如XMLprotocol buffers 就不是一个很好的选项,
因为你不能使用 protocol buffer 更好的在文档中进行交换。更主要的是 HTML 是人类可以阅读和编辑的。protocol buffer 也不是不可以人为的读取,但是针对原生的 protocol buffer 格式是没有办法人为进行读取和编辑的。
XML 与 HTML 一样在某种程度上是一种自我描述数据。protocol buffer 只针对你在 .proto 文件中描述的内容进行表达。
## 看起来像一个解决方案,我应该如何开始呢
Download the package 这包中含有针对 Java, Python, 和 C++ protocol buffer 编译器源代码,和你需要进行 I/O 和测试的类。希望对你的编译器进行编译和构建,请参考代码中的 README 文件。
一旦你完成了所有的设置,请参考 tutorial 页面中的内容来选择你需要的语言——这个能够帮助你使用 protocol buffer 创建一个简单的应用程序。
## 介绍 proto3
在我们最新的 version 3 发行版 中推出了新的语言版本 —— Protocol Buffers language version 3另称 proto3在这个版本中针对我们已经存在的语言版本proto2使用了一些新的特性。
Proto3 简化了 protocol buffer 语言,使其更加容易使用并且能够支持更多的语言:我们当前发行的 proto3 能够让你创建 Java, C++, Python, Java Lite, Ruby, JavaScript, Objective-C, and C#。
另外你也可以通过使用 Go protoc 插件来用 proto3 创建 Go 代码,这个插件你可以到 golang/protobuf Github 中下载到。更多的语言还在逐步进行支持中。
请注意,这 2 个版本的 API 并不是完全兼容的。为了照顾还在使用老版本的用户,我们将会在新的 protocol buffers 发行中同时支持老的版本。
你可以在下面的发行日志release notes查看 2 个版本的主要不同。有关 proto3 的句法,请参考 Proto3 Language Guide 中的内容,针对 proto3 的完整文档还没有编写完成,将会随后推出。
看起来 proto2 和 proto3 可能会产生一些混淆,这是因为原始的开源 protocol buffers 实际上是 Google 内部语言的第二个版本,同时我们的开源版本也是从 v2.0.0 开始的。
简单来说就是 proto 最开始的版本是 Google 内部使用的,在 proto 第二个版本的时候Google 决定进行开源了,所以开源的 proto 是从 proto2 开始的。
## 一个简短的历史
Protocol buffers 最开始是在 Google 内部进行开发的,用于处理在索引服务器上请求/响应request/response的协议。
在 Protocol buffers 之前,针对请求和响应,使用的是 marshalling/unmarshalling这个能够支持一系列的协议。但是结果看起来却是非常的难看例如
```
if (version == 3) {
...
} else if (version > 4) {
if (version == 5) {
...
}
...
}
```
明确格式化的的协议也使新版本的协议更加难以推出,这是因为开发者必须能够了解老协议在服务器之间是如何进行处理的,同时也需要了解新的协议。只有对新老协议都有所了解后才能逐步使用新的协议替换老的协议。
Protocol buffers 被用来设计解决上面的很多问题:
* 新的字段比较能够容易的进行定义,中级服务器不需要对数据进行检查,直接对数据进行处理,同时也可以直接传输数据而不需要了解数据是如何进行定义的。
* 格式使用自描述能够更加容易支持更多的语言C++Java 等)。
但是用户还是需要手动书写他们自己的处理diam。
作为系统的进化来说,它获得了许多其他的特性和用途:
* 自动生成序列化和反序列化代码而避免手动书写这些代码。
* 除了开始使用短期RPC远程过程调用请求人们开始使用 protocol buffers 作为高效的自描述结构化数据格式(主要针对数据短期存在,例如在 Bigtable
* 服务器RPC接口开始被声明为协议文件的一部分协议编译器生成根类用户可以通过服务器接口的实现和重载它们。
Protocol buffers 在 Google 中成为针对数据的通用语言—— 随着时间的流逝,在 Google 内部已经有超过 348,952 .proto 文件被定义。这些被用在 RPC 系统和存储系统中存储数据。

View File

@ -1,28 +0,0 @@
# CWIKIUS SPRING 文档和项目快速导航
欢迎来到 CWIKIUS SPRING 文档和手册的空间
Spring 有关的文档和项目 Confluence Wiki请访问[https://www.cwiki.us/display/CWIKIUSDOCS/Spring+Docs](https://www.cwiki.us/display/CWIKIUSDOCS/Spring+Docs)
如果您有兴趣参与我们的小组和项目,请使用下面的联系方式和我们联系:
| 联系方式名称 | 联系方式 |
|---|---|
| 电子邮件 | [service@ossez.com](mailto:service@ossez.com) |
| QQ 或微信 | 103899765 |
| QQ 交流群 Spring | 15186112 |
| 社区论坛 | [https://www.ossez.com/](https://www.ossez.com/) |
## Spring Data JPA
在下面的表格中,我们列出了一些比较有用的 CWIKIUS 相关软件开发使用教程的导航,在我们文档的整理中,也参考了一些这些文档。
在这里对原作者表示感谢。
| 网站名称 | URL | NOTE |
|---|---|---|
| 源代码 | [https://github.com/cwiki-us-spring/spring-data-jpa](https://github.com/cwiki-us-spring/spring-data-jpa) | 下面编译结果使用的源代码 |
| 参考 | [https://cdn.ossez.com/docs/spring-docs/spring-data-jpa/reference/html/index.html](https://cdn.ossez.com/docs/spring-docs/spring-data-jpa/reference/html/index.html) | 从官方代码库中 Fork 下来的代码后进行中文化编译后的的文档 |
| API | [https://cdn.ossez.com/docs/spring-docs/spring-data-jpa/apidocs/index.html](https://cdn.ossez.com/docs/spring-docs/spring-data-jpa/apidocs/index.html) | 官方代码库中 Fork 下面的代码后编译的 API 参考 |