-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from traP-jp/proto
🎉 Write protos
- Loading branch information
Showing
10 changed files
with
531 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
--- | ||
BasedOnStyle: WebKit | ||
Language: Proto | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: AlwaysBreak | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveBitFields: false | ||
AlignConsecutiveDeclarations: false | ||
AlignConsecutiveMacros: false | ||
AlignEscapedNewlines: Left | ||
AlignOperands: Align | ||
|
||
BreakBeforeBinaryOperators: All | ||
AlignTrailingComments: true | ||
|
||
AllowAllArgumentsOnNextLine: true | ||
|
||
AllowAllConstructorInitializersOnNextLine: true | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
|
||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: Empty | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortEnumsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortIfStatementsOnASingleLine: WithoutElse | ||
AllowShortLambdasOnASingleLine: All | ||
AllowShortLoopsOnASingleLine: true | ||
# AlwaysBreakAfterDefinitionReturnType: None # DEPRECATED | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: MultiLine | ||
BinPackArguments: true | ||
BinPackParameters: true | ||
|
||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterClass: false | ||
AfterControlStatement: MultiLine | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
# AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: true | ||
BeforeElse: false | ||
BeforeLambdaBody: false | ||
BeforeWhile: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
IndentExternBlock: AfterExternBlock | ||
|
||
BreakBeforeTernaryOperators: true | ||
|
||
BreakConstructorInitializers: AfterColon | ||
# BreakConstructorInitializersBeforeComma: false | ||
|
||
BreakInheritanceList: AfterColon | ||
# BreakBeforeInheritanceComma: false | ||
|
||
# BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
ColumnLimit: 100 | ||
CommentPragmas: "" | ||
CompactNamespaces: false | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
|
||
DeriveLineEnding: true | ||
UseCRLF: false | ||
|
||
DerivePointerAlignment: true | ||
PointerAlignment: Right | ||
|
||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
ForEachMacros: [] | ||
IncludeBlocks: Preserve | ||
|
||
IncludeCategories: | ||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/' | ||
Priority: 2 | ||
SortPriority: 0 | ||
- Regex: '^(<|"(gtest|gmock|isl|json)/)' | ||
Priority: 3 | ||
SortPriority: 0 | ||
- Regex: ".*" | ||
Priority: 1 | ||
SortPriority: 0 | ||
|
||
IncludeIsMainRegex: "(Test|_test)?$" | ||
IncludeIsMainSourceRegex: "" | ||
|
||
IndentCaseBlocks: false | ||
IndentCaseLabels: false | ||
|
||
IndentGotoLabels: true | ||
IndentPPDirectives: None | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: false | ||
InsertTrailingCommas: None | ||
# JavaImportGroups | ||
# JavaScriptQuotes: Leave | ||
# JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
|
||
MacroBlockBegin: "" | ||
MacroBlockEnd: "" | ||
|
||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: Inner | ||
NamespaceMacros: [] | ||
|
||
# ObjCBinPackProtocolList: Auto | ||
# ObjCBlockIndentWidth: 4 | ||
# ObjCBreakBeforeNestedBlockParam: true | ||
# ObjCSpaceAfterProperty: true | ||
# ObjCSpaceBeforeProtocolList: true | ||
|
||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakTemplateDeclaration: 10 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 60 | ||
|
||
ReflowComments: true | ||
SortIncludes: true | ||
SortUsingDeclarations: true | ||
|
||
SpaceAfterCStyleCast: false | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceBeforeSquareBrackets: false | ||
SpaceInEmptyBlock: false | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInAngles: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInConditionalStatement: false | ||
# SpacesInContainerLiterals: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
|
||
Standard: c++11 | ||
StatementMacros: [] | ||
TabWidth: 4 | ||
UseTab: Never | ||
WhitespaceSensitiveMacros: [] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# proto | ||
|
||
```mermaid | ||
graph LR | ||
World[world.proto] | ||
User[user.proto] | ||
Auth[auth.proto] | ||
SpeakerPhone[speaker_phone.proto] | ||
Reaction[reaction.proto] | ||
Message[message.proto] | ||
Explore[explore.proto] | ||
SpeakerPhone --> World | ||
Reaction --> World | ||
Message --> World | ||
Explore --> World | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
syntax = "proto3"; | ||
|
||
package auth; | ||
|
||
message AuthRequest {} | ||
|
||
message AuthResponse { | ||
// リダイレクト先 | ||
string location = 1; | ||
} | ||
|
||
service AuthService { | ||
// OAuth認証 | ||
// レスポンスのlocationにリダイレクトすることでOAuth認証を行う | ||
rpc Auth(AuthRequest) returns (AuthResponse); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
syntax = "proto3"; | ||
|
||
package explore; | ||
|
||
import "world.proto"; | ||
|
||
// 探索者; 探索中のユーザー | ||
message Explorer { | ||
// UUID (ULIDかも) ユーザーIDとは別物 | ||
string id = 1; | ||
// ユーザーID | ||
// ユーザーの情報はuser.protoに記述 | ||
string user_id = 2; | ||
// そのユーザーの現在地 座標 | ||
world.Coordinate position = 3; | ||
} | ||
|
||
// 探索者が一度に表示できる領域 | ||
message ExplorationField { | ||
// 中心座標 | ||
world.Coordinate position = 1; | ||
// 表示範囲 | ||
world.Size size = 2; | ||
} | ||
|
||
message ExplorerAction { | ||
// 探索者がオンラインになった時 | ||
message Arrive { | ||
// 探索者のID | ||
string id = 1; | ||
// 探索者の現在地 | ||
world.Coordinate position = 2; | ||
} | ||
|
||
// 探索者が移動した時 | ||
message Move { | ||
// 探索者のID | ||
string id = 1; | ||
// 探索者の現在地 | ||
world.Coordinate position = 2; | ||
} | ||
|
||
// 探索者がオフラインになった時 | ||
message Leave { | ||
// 探索者のID | ||
string id = 1; | ||
} | ||
|
||
oneof action { | ||
Arrive arrive = 1; | ||
Move move = 2; | ||
Leave leave = 3; | ||
} | ||
} | ||
|
||
// フィールド探索中のイベント | ||
message ExplorationFieldEvents { | ||
// 新しいメッセージのIDリスト | ||
// 直近に投稿されたメッセージ、以前に投稿されたがExplorationFieldに入ったメッセージを含む | ||
repeated string messages = 1; | ||
// 新しいスピーカーフォンのIDリスト | ||
// 直近に設置されたスピーカーフォン、以前に設置されたがExplorationFieldに入ったスピーカーフォンを含む | ||
repeated string speaker_phones = 2; | ||
// 新しいリアクションのIDリスト | ||
// 直近のリアクションのみを含む | ||
// 以前のリアクションは含まない; すぐに揮発して見えなくなるため | ||
repeated string reactions = 3; | ||
// 探索者の更新全般 | ||
// 新しくオンラインになったユーザー、既にオンラインで移動したユーザー、オフラインになったユーザーを含む | ||
repeated ExplorerAction explorer_actions = 4; | ||
// 整合性チェックのために追加するかも | ||
// world.Coordinate position = 5; | ||
} | ||
|
||
service ExploreService { | ||
// 探索ストリーム | ||
// ExplorationField: 探索者が移動する度にクライアントから送信する | ||
// ExplorationFieldEvents: 他の探索者の移動、メッセージの投稿等のイベントを受信する | ||
// ExplorationFieldの更新に伴って既存の探索者、既存のメッセージも受信する | ||
rpc Explore(stream ExplorationField) returns (stream ExplorationFieldEvents); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
syntax = "proto3"; | ||
|
||
// messageだと予約後に衝突するため | ||
package msg; | ||
|
||
import "google/protobuf/timestamp.proto"; | ||
|
||
import "world.proto"; | ||
|
||
message Message { | ||
// UUID | ||
string id = 1; | ||
// 送信者のユーザーID | ||
string user_id = 2; | ||
// メッセージの座標 | ||
world.Coordinate position = 3; | ||
// メッセージの内容 | ||
string content = 4; | ||
// 送信日時 | ||
google.protobuf.Timestamp created_at = 5; | ||
// 更新日時 | ||
// 今の所メッセージの更新はしないが、将来的には更新できるようにするかも | ||
google.protobuf.Timestamp updated_at = 6; | ||
// ユーザーがアクセスできる期限 | ||
google.protobuf.Timestamp expires_at = 7; | ||
} | ||
|
||
message GetMessageRequest { | ||
string id = 1; | ||
} | ||
|
||
message GetMessageResponse { | ||
Message message = 1; | ||
} | ||
|
||
message CreateMessageRequest { | ||
// メッセージの座標 | ||
world.Coordinate position = 1; | ||
// メッセージの内容 | ||
string content = 2; | ||
} | ||
|
||
message CreateMessageResponse { | ||
Message message = 1; | ||
} | ||
|
||
service MessageService { | ||
rpc GetMessage(GetMessageRequest) returns (GetMessageResponse); | ||
|
||
rpc CreateMessage(CreateMessageRequest) returns (CreateMessageResponse); | ||
|
||
// メッセージの編集、削除はしない | ||
// rpc UpdateMessage(UpdateMessageRequest) returns (UpdateMessageResponse); | ||
// rpc DeleteMessage(DeleteMessageRequest) returns (DeleteMessageResponse); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
syntax = "proto3"; | ||
|
||
package reaction; | ||
|
||
import "google/protobuf/timestamp.proto"; | ||
|
||
import "world.proto"; | ||
|
||
message Reaction { | ||
// UUID | ||
string id = 1; | ||
// リアクションをしたユーザーのID | ||
string user_id = 2; | ||
// リアクションをした座標 | ||
world.Coordinate position = 3; | ||
// リアクションの種類 | ||
string kind = 4; | ||
// リアクションをした日時 | ||
google.protobuf.Timestamp created_at = 5; | ||
// ユーザーがアクセスできる期限 | ||
// TODO: このフィールドは必要か? | ||
google.protobuf.Timestamp expires_at = 6; | ||
} | ||
|
||
message GetReactionRequest { | ||
string id = 1; | ||
} | ||
|
||
message GetReactionResponse { | ||
Reaction reaction = 1; | ||
} | ||
|
||
// リアクションの作成 | ||
message CreateReactionRequest { | ||
// リアクションをする座標 | ||
world.Coordinate position = 2; | ||
// リアクションの種類 | ||
string kind = 1; | ||
} | ||
|
||
message CreateReactionResponse { | ||
reaction.Reaction reaction = 1; | ||
} | ||
|
||
service ReactionService { | ||
rpc GetReaction(GetReactionRequest) returns (GetReactionResponse); | ||
|
||
rpc CreateReaction(CreateReactionRequest) returns (CreateReactionResponse); | ||
|
||
// リアクションの編集、削除はしない | ||
// rpc UpdateReaction(UpdateReactionRequest) returns (UpdateReactionResponse); | ||
// rpc DeleteReaction(DeleteReactionRequest) returns (DeleteReactionResponse); | ||
} |
Oops, something went wrong.