Skip to content

Commit f6959b1

Browse files
author
Frankee.zhou
committed
first commit
0 parents  commit f6959b1

File tree

69 files changed

+23903
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+23903
-0
lines changed

.gitignore

+199
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
2+
# Created by https://www.gitignore.io/api/go,c++,java,cmake,intellij+all,visualstudiocode
3+
# Edit at https://www.gitignore.io/?templates=go,c++,java,cmake,intellij+all,visualstudiocode
4+
5+
### C++ ###
6+
# Prerequisites
7+
*.d
8+
9+
# Compiled Object files
10+
*.slo
11+
*.lo
12+
*.o
13+
*.obj
14+
15+
# Precompiled Headers
16+
*.gch
17+
*.pch
18+
19+
# Compiled Dynamic libraries
20+
*.so
21+
*.dylib
22+
*.dll
23+
24+
# Compiled Static libraries
25+
*.lai
26+
*.la
27+
*.a
28+
*.lib
29+
30+
# Executables
31+
*.exe
32+
*.out
33+
*.app
34+
35+
### CMake ###
36+
cpp/CMakeLists.txt.user
37+
cpp/CMakeCache.txt
38+
cpp/CMakeFiles
39+
cpp/CMakeScripts
40+
cpp/Testing
41+
cpp/Makefile
42+
cpp/cmake_install.cmake
43+
cpp/install_manifest.txt
44+
cpp/compile_commands.json
45+
cpp/CTestTestfile.cmake
46+
_deps
47+
48+
### CMake Patch ###
49+
# External projects
50+
*-prefix/
51+
52+
### Go ###
53+
# Binaries for programs and plugins
54+
*.exe~
55+
56+
# Test binary, built with `go test -c`
57+
*.test
58+
59+
# Output of the go coverage tool, specifically when used with LiteIDE
60+
61+
# Dependency directories (remove the comment below to include it)
62+
# vendor/
63+
64+
### Go Patch ###
65+
/go/vendor/
66+
/Godeps/
67+
68+
### Intellij+all ###
69+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
70+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
71+
72+
antlr/.antlr
73+
antlr/gen/
74+
antlr/MojoLexer.tokens
75+
76+
# User-specific stuff
77+
.idea/**/workspace.xml
78+
.idea/**/tasks.xml
79+
.idea/**/usage.statistics.xml
80+
.idea/**/dictionaries
81+
.idea/**/shelf
82+
83+
# Generated files
84+
.idea/**/contentModel.xml
85+
86+
# Sensitive or high-churn files
87+
.idea/**/dataSources/
88+
.idea/**/dataSources.ids
89+
.idea/**/dataSources.local.xml
90+
.idea/**/sqlDataSources.xml
91+
.idea/**/dynamic.xml
92+
.idea/**/uiDesigner.xml
93+
.idea/**/dbnavigator.xml
94+
95+
# Gradle
96+
.idea/**/gradle.xml
97+
.idea/**/libraries
98+
99+
# Gradle and Maven with auto-import
100+
# When using Gradle or Maven with auto-import, you should exclude module files,
101+
# since they will be recreated, and may cause churn. Uncomment if using
102+
# auto-import.
103+
# .idea/modules.xml
104+
# .idea/*.iml
105+
# .idea/modules
106+
# *.iml
107+
# *.ipr
108+
109+
# CMake
110+
cmake-build-*/
111+
112+
# Mongo Explorer plugin
113+
.idea/**/mongoSettings.xml
114+
115+
# File-based project format
116+
*.iws
117+
118+
# IntelliJ
119+
out/
120+
121+
# mpeltonen/sbt-idea plugin
122+
.idea_modules/
123+
124+
# JIRA plugin
125+
atlassian-ide-plugin.xml
126+
127+
# Cursive Clojure plugin
128+
.idea/replstate.xml
129+
130+
# Crashlytics plugin (for Android Studio and IntelliJ)
131+
com_crashlytics_export_strings.xml
132+
crashlytics.properties
133+
crashlytics-build.properties
134+
fabric.properties
135+
136+
# Editor-based Rest Client
137+
.idea/httpRequests
138+
139+
# Android studio 3.1+ serialized cache file
140+
.idea/caches/build_file_checksums.ser
141+
142+
### Intellij+all Patch ###
143+
# Ignores the whole .idea folder and all .iml files
144+
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
145+
146+
.idea/
147+
148+
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
149+
150+
*.iml
151+
modules.xml
152+
.idea/misc.xml
153+
*.ipr
154+
155+
# Sonarlint plugin
156+
.idea/sonarlint
157+
158+
### Java ###
159+
# Compiled class file
160+
*.class
161+
162+
# Log file
163+
*.log
164+
165+
# BlueJ files
166+
*.ctxt
167+
168+
# Mobile Tools for Java (J2ME)
169+
.mtj.tmp/
170+
171+
# Package Files #
172+
*.jar
173+
*.war
174+
*.nar
175+
*.ear
176+
*.zip
177+
*.tar.gz
178+
*.rar
179+
180+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
181+
hs_err_pid*
182+
183+
### VisualStudioCode ###
184+
.vscode/*
185+
!.vscode/settings.json
186+
!.vscode/tasks.json
187+
!.vscode/launch.json
188+
!.vscode/extensions.json
189+
190+
### VisualStudioCode Patch ###
191+
# Ignore all local history of files
192+
.history
193+
194+
.DS_Store
195+
196+
java/target/
197+
java/mojo-parser/target/
198+
199+
# End of https://www.gitignore.io/api/go,c++,java,cmake,intellij+all,visualstudiocode

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Rpc Package
2+
3+
##
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
| 字段 | 类型 | 格式类型 | 是否必须 | 默认值 | 说明 |
2+
|---|---|---|---|---|---|
3+
| `service` | `string` | || | The API service name. It is a logical identifier for a networked API,such as "pubsub.googleapis.com". The naming syntax depends on theAPI management system being used for handling the request. |
4+
| `operation` | `string` | || | The API operation name. For gRPC requests, it is the fully qualified APImethod name, such as "google.pubsub.v1.Publisher.Publish". For OpenAPIrequests, it is the `operationId`, such as "getPet". |
5+
| `protocol` | `string` | || | The API protocol used for sending the request, such as "http", "https","grpc", or "internal". |
6+
| `version` | `string` | || | The API version associated with the API operation above, such as "v1" or"v1alpha1". |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
| 字段 | 类型 | 格式类型 | 是否必须 | 默认值 | 说明 |
2+
|---|---|---|---|---|---|
3+
| `principal` | `string` | || | The authenticated principal. Reflects the issuer (`iss`) and subject(`sub`) claims within a JWT. The issuer and subject should be `/`delimited, with `/` percent-encoded within the subject fragment. ForGoogle accounts, the principal format is:"https://accounts.google.com/{id}" |
4+
| `audiences` | `Array<string>` | | 否 | | The intended audience(s) for this authentication information. Reflectsthe audience (`aud`) claim within a JWT. The audiencevalue(s) depends on the `issuer`, but typically include one or more ofthe following pieces of information:<br>- The services intended to receive the credential. For example,
5+
["https://pubsub.googleapis.com/", "https://storage.googleapis.com/"].- A set of service-based scopes. For example,
6+
["https://www.googleapis.com/auth/cloud-platform"].- The client id of an app, such as the Firebase project id for JWTs
7+
from Firebase Auth.<br>Consult the documentation for the credential issuer to determine theinformation provided. |
8+
| `presenter` | `string` | || | The authorized presenter of the credential. Reflects the optionalAuthorized Presenter (`azp`) claim within a JWT or theOAuth client id. For example, a Google Cloud Platform client id looksas follows: "123456789012.apps.googleusercontent.com". |
9+
| `claims` | `Map<string, mojo.core.Value>` | || | Structured claims presented with the credential. JWTs include`{key: value}` pairs for standard and private claims. The followingis a subset of the standard required and optional claims that wouldtypically be presented for a Google-based JWT:<br>{'iss': 'accounts.google.com','sub': '113289723416554971153','aud': ['123456789012', 'pubsub.googleapis.com'],'azp': '123456789012.apps.googleusercontent.com','email': '[email protected]','iat': 1353601026,'exp': 1353604926}<br>SAML assertions are similarly specified, but with an identity providerdependent structure. |
10+
| `accessLevels` | `Array<string>` | || | A list of access level resource names that allow resources to beaccessed by authenticated requester. It is part of Secure GCP processingfor the incoming request. An access level string has the format:"//{api_service_name}/accessPolicies/{policy_id}/accessLevels/{short_name}"<br>Example:"//accesscontextmanager.googleapis.com/accessPolicies/MY_POLICY_ID/accessLevels/MY_LEVEL" |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
| 字段 | 类型 | 格式类型 | 是否必须 | 默认值 | 说明 |
2+
|---|---|---|---|---|---|
3+
| `ip` | `string` | || | The IP address of the peer. |
4+
| `port` | `integer` | `int64` || | The network port of the peer. |
5+
| `labels` | `Map<string, string>` | || | The labels associated with the peer. |
6+
| `principal` | `string` | || | The identity of this peer. Similar to `Request.auth.principal`, butrelative to the peer instead of the request. For example, theidenity associated with a load balancer that forwared the request. |
7+
| `regionCode` | `string` | || | The CLDR country/region code associated with the above IP address.If the IP address is private, the `region_code` should reflect thephysical location where this peer is running. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
| 字段 | 类型 | 格式类型 | 是否必须 | 默认值 | 说明 |
2+
|---|---|---|---|---|---|
3+
| `id` | `string` | || | The unique ID for a request, which can be propagated to downstreamsystems. The ID should have low probability of collisionwithin a single day for a specific service. |
4+
| `method` | `string` | || | The HTTP request method, such as `GET`, `POST`. |
5+
| `headers` | `Map<string, string>` | || | The HTTP request headers. If multiple headers share the same key, theymust be merged according to the HTTP spec. All header keys must belowercased, because HTTP header keys are case-insensitive. |
6+
| `path` | `string` | || | The HTTP URL path. |
7+
| `host` | `string` | || | The HTTP request `Host` header value. |
8+
| `scheme` | `string` | || | The HTTP URL scheme, such as `http` and `https`. |
9+
| `query` | `string` | || | The HTTP URL query in the format of `name1=value1&name2=value2`, as itappears in the first line of the HTTP request. No decoding is performed. |
10+
| `time` | `string` | `DateTime` || | The timestamp when the `destination` service receives the last byte ofthe request. |
11+
| `size` | `integer` | `int64` || | The HTTP request size in bytes. If unknown, it must be -1. |
12+
| `protocol` | `string` | || | The network protocol used with the request, such as "http/1.1","spdy/3", "h2", "h2c", "webrtc", "tcp", "udp", "quic". Seefor details. |
13+
| `reason` | `string` | || | A special parameter for request reason. It is used by security systemsto associate auditing information with a request. |
14+
| `auth` | `mojo.rpc.AttributeContext.Auth` | || | The request authentication. May be absent for unauthenticated requests.Derived from the HTTP request `Authorization` header or equivalent. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
| 字段 | 类型 | 格式类型 | 是否必须 | 默认值 | 说明 |
2+
|---|---|---|---|---|---|
3+
| `service` | `string` | || | The name of the service that this resource belongs to, such as`pubsub.googleapis.com`. The service may be different from the DNShostname that actually serves the request. |
4+
| `name` | `string` | | 否 | | The stable identifier (name) of a resource on the `service`. A resourcecan be logically identified as "//{resource.service}/{resource.name}".The differences between a resource name and a URI are:<br>- Resource name is a logical identifier, independent of network
5+
protocol and API version. For example,
6+
`//pubsub.googleapis.com/projects/123/topics/news-feed`.- URI often includes protocol and version information, so it can
7+
be used directly by applications. For example,
8+
`https://pubsub.googleapis.com/v1/projects/123/topics/news-feed`.<br>See for details. |
9+
| `type` | `string` | || | The type of the resource. The syntax is platform-specific becausedifferent platforms define their resources differently.<br>For Google APIs, the type format must be "{service}/{kind}". |
10+
| `labels` | `Map<string, string>` | || | The labels or tags on the resource, such as AWS resource tags andKubernetes resource labels. |
11+
| `uid` | `string` | || | The unique identifier of the resource. UID is unique in the timeand space for this resource within the scope of the service. It istypically generated by the server on successful creation of a resourceand must not be changed. UID is used to uniquely identify resourceswith resource name reuses. This should be a UUID4. |
12+
| `annotations` | `Map<string, string>` | || | Annotations is an unstructured key-value map stored with a resource thatmay be set by external tools to store and retrieve arbitrary metadata.They are not queryable and should be preserved when modifying objects.<br>More info: |
13+
| `displayName` | `string` | || | Mutable. The display name set by clients. Must be <= 63 characters. |
14+
| `createTime` | `string` | `DateTime` || | Output only. The timestamp when the resource was created. This maybe either the time creation was initiated or when it was completed. |
15+
| `updateTime` | `string` | `DateTime` || | Output only. The timestamp when the resource was last updated. Anychange to the resource made by users must refresh this value.Changes to a resource made by the service should refresh this value. |
16+
| `deleteTime` | `string` | `DateTime` || | Output only. The timestamp when the resource was deleted.If the resource is not deleted, this must be empty. |
17+
| `etag` | `string` | || | Output only. An opaque value that uniquely identifies a version orgeneration of a resource. It can be used to confirm that the clientand server agree on the ordering of a resource being written. |
18+
| `location` | `string` | || | Immutable. The location of the resource. The location encoding isspecific to the service provider, and new encoding may be introducedas the service evolves.<br>For Google Cloud products, the encoding is what is used by Google CloudAPIs, such as `us-east1`, `aws-us-east-1`, and `azure-eastus2`. Thesemantics of `location` is identical to the`cloud.googleapis.com/location` label used by some Google Cloud APIs. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
| 字段 | 类型 | 格式类型 | 是否必须 | 默认值 | 说明 |
2+
|---|---|---|---|---|---|
3+
| `code` | `integer` | `int64` || | The HTTP response status code, such as `200` and `404`. |
4+
| `size` | `integer` | `int64` || | The HTTP response size in bytes. If unknown, it must be -1. |
5+
| `headers` | `Map<string, string>` | || | The HTTP response headers. If multiple headers share the same key, theymust be merged according to HTTP spec. All header keys must belowercased, because HTTP header keys are case-insensitive. |
6+
| `time` | `string` | `DateTime` || | The timestamp when the `destination` service sends the last byte ofthe response. |
7+
| `backendLatency` | `string` | `Duration` || | The length of time it takes the backend service to fully respond to arequest. Measured from when the destination service starts to send therequest to the backend until when the destination service receives thecomplete response from the backend. |
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
| 字段 | 类型 | 格式类型 | 是否必须 | 默认值 | 说明 |
2+
|---|---|---|---|---|---|
3+
| `origin` | `mojo.rpc.AttributeContext.Peer` | || | The origin of a network activity. In a multi hop network activity,the origin represents the sender of the first hop. For the first hop,the `source` and the `origin` must have the same content. |
4+
| `source` | `mojo.rpc.AttributeContext.Peer` | || | The source of a network activity, such as starting a TCP connection.In a multi hop network activity, the source represents the sender of thelast hop. |
5+
| `destination` | `mojo.rpc.AttributeContext.Peer` | || | The destination of a network activity, such as accepting a TCP connection.In a multi hop network activity, the destination represents the receiver ofthe last hop. |
6+
| `request` | `mojo.rpc.AttributeContext.Request` | || | Represents a network request, such as an HTTP request. |
7+
| `response` | `mojo.rpc.AttributeContext.Response` | || | Represents a network response, such as an HTTP response. |
8+
| `resource` | `mojo.rpc.AttributeContext.Resource` | || | Represents a target resource that is involved with a network activity.If multiple resources are involved with an activity, this must be theprimary one. |
9+
| `api` | `mojo.rpc.AttributeContext.Api` | || | Represents an API operation that is involved to a network activity. |
10+
| `extensions` | `Array<mojo.core.Any>` | || | Supports extensions for advanced use cases, such as logs and metrics. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
| 字段 | 类型 | 格式类型 | 是否必须 | 默认值 | 说明 |
2+
|---|---|---|---|---|---|
3+
| `name` | `string` | || | The server-assigned name, which is only unique within the same service thatoriginally returns it. If you use the default HTTP mapping, the`name` should be a resource name ending with `operations/{unique_id}`. |
4+
| `metadata` | `mojo.core.Any` | || | Service-specific metadata associated with the operation. It typicallycontains progress information and common metadata such as create time.Some services might not provide such metadata. Any method that returns along-running operation should document the metadata type, if any. |
5+
| `done` | `boolean` | || | If the value is `false`, it means the operation is still in progress.If `true`, the operation is completed, and either `error` or `response` isavailable. |
6+
| `result` | `Union<mojo.core.Error,mojo.core.Any>` | || | The operation result, which can be either an `error` or a valid `response`.If `done` == `false`, neither `error` nor `response` is set.If `done` == `true`, exactly one of `error` or `response` is set. |

0 commit comments

Comments
 (0)