-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aeon: connect implementation #1065
base: master
Are you sure you want to change the base?
Conversation
e743db4
to
4e6f784
Compare
ba43ee0
to
7c44fea
Compare
4e6f784
to
90c3018
Compare
7c44fea
to
6f2cdc8
Compare
90c3018
to
f6a666b
Compare
8a3c46a
to
4151819
Compare
75ee5c5
to
81f879f
Compare
81f879f
to
243e95c
Compare
40a246a
to
b09a2db
Compare
903da6a
to
543f89a
Compare
9890383
to
84a305e
Compare
The ‘Console’ module has been separate from the ‘Connect’ abstraction, to allow it being used independently of the transport layer. Part of #1050
Update aeon-api-protos module and adjust code for it requirements.
84a305e
to
75fc2c9
Compare
75fc2c9
to
344b475
Compare
prepare-[ce|ee]-test-env - fixed preparing test requirements. static-code-check - removed extra steps what was did on previous steps. Changes are needed to adjust the CI/CD settings to match their step name. Which in turn allows you to properly manage the order of actions during the build testing.
344b475
to
3cc50af
Compare
[submodule "cli/aeon/protos"] | ||
path = cli/aeon/protos | ||
url = [email protected]:tarantool/aeon-api-protos.git | ||
branch = master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to specify a branch here? Or just a commit would be enough.
@@ -16,4 +16,8 @@ type ConnectCtx struct { | |||
Ssl Ssl | |||
// Transport is a connection mode. | |||
Transport Transport | |||
// Network is kind of transport layer. | |||
Network string | |||
// Address is a connection Url, unix socket address and etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Address is a connection Url, unix socket address and etc. | |
// Address is a connection URL, unix socket address and etc. |
if [ ! -x "$(command -v protoc-gen-go)" ]; then | ||
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | ||
fi | ||
|
||
if [ ! -x "$(command -v protoc-gen-go-grpc)" ]; then | ||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not install it automatically. It's better to add requirements here:
https://github.com/tarantool/tt?tab=readme-ov-file#build-from-source
And install it by mage (I'm not sure about the current approach) or on CI manually.
if [ ! -x "$(command -v protoc-gen-go)" ]; then | |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | |
fi | |
if [ ! -x "$(command -v protoc-gen-go-grpc)" ]; then | |
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest | |
fi | |
if [ ! -x "$(command -v protoc-gen-go)" ]; then | |
echo "foo" | |
exit 1 | |
fi | |
if [ ! -x "$(command -v protoc-gen-go-grpc)" ]; then | |
echo "foo" | |
exit 1 | |
fi |
it also a good idea to add a target into magefile.go to generate the code or update a some exists target.
Motivation: it's a bad idea to install some software for a user in a background.
IP = 127.0.0.1 | ||
EOF | ||
|
||
### Server .key&.crt and ca.crt required for Server-Side TLS mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Server .key&.crt and ca.crt required for Server-Side TLS mode. | |
### Server .key.crt and ca.crt required for Server-Side TLS mode. |
func getTlsConfig(args cmd.Ssl) *tls.Config { | ||
if args.CaFile == "" { | ||
return &tls.Config{ | ||
ClientAuth: tls.NoClientCert, | ||
} | ||
} | ||
|
||
ca, err := os.ReadFile(args.CaFile) | ||
if err != nil { | ||
log.Fatalf("Failed to read CA file: %v", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, avoid an error processing in that manner:
- It is harder to test.
- It is harder to understand which parts of the code may result an error.
func getTlsConfig(args cmd.Ssl) *tls.Config { | |
if args.CaFile == "" { | |
return &tls.Config{ | |
ClientAuth: tls.NoClientCert, | |
} | |
} | |
ca, err := os.ReadFile(args.CaFile) | |
if err != nil { | |
log.Fatalf("Failed to read CA file: %v", err) | |
} | |
func getTlsConfig(args cmd.Ssl) (*tls.Config, error) { | |
if args.CaFile == "" { | |
return &tls.Config{ | |
ClientAuth: tls.NoClientCert, | |
} | |
} | |
ca, err := os.ReadFile(args.CaFile) | |
if err != nil { | |
fmt.Errorf("Failed to read CA file: %w", err) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add tests.
// Handler is a auxiliary abstraction to isolate the console from | ||
// the implementation of a particular instruction processor. | ||
type Handler interface { | ||
// Title return name of instruction processor instance. | ||
Title() string | ||
|
||
// Validate the input string. | ||
Validate(input string) bool | ||
|
||
// Complete checks the input and return available variants to continue typing. | ||
Complete(input prompt.Document) []prompt.Suggest | ||
|
||
// Execute accept input to perform actions defined by client implementation. | ||
// Expecting that result type implements Formatter interface. | ||
Execute(input string) any | ||
|
||
// Close notify handler to terminate execution and close any opened streams. | ||
Close() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Handler is a auxiliary abstraction to isolate the console from | |
// the implementation of a particular instruction processor. | |
type Handler interface { | |
// Title return name of instruction processor instance. | |
Title() string | |
// Validate the input string. | |
Validate(input string) bool | |
// Complete checks the input and return available variants to continue typing. | |
Complete(input prompt.Document) []prompt.Suggest | |
// Execute accept input to perform actions defined by client implementation. | |
// Expecting that result type implements Formatter interface. | |
Execute(input string) any | |
// Close notify handler to terminate execution and close any opened streams. | |
Close() | |
} | |
// Handler is a auxiliary abstraction to isolate the console from | |
// the implementation of a particular instruction processor. | |
type Handler interface { | |
// Title return name of instruction processor instance. | |
Title() string | |
// Validate the input string. | |
Validate(input string) bool | |
// Complete checks the input and return available variants to continue typing. | |
Complete(input prompt.Document) []prompt.Suggest | |
// Execute accept input to perform actions defined by client implementation. | |
// Expecting that result type implements Formatter interface. | |
Execute(input string) any | |
// Close notify handler to terminate execution and close any opened streams. | |
Close() | |
} |
Complete(input prompt.Document) []prompt.Suggest | ||
|
||
// Execute accept input to perform actions defined by client implementation. | ||
// Expecting that result type implements Formatter interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why does it return any
?
const ( | ||
DefaultHistoryFileName = ".tarantool_history" | ||
DefaultHistoryLines = 10000 | ||
) | ||
|
||
type History struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And missed tests.
Please, add a CHANGELOG.md entry and a TarantoolBot comment too. |
Mock server Implement some base methods for integration tests.
Part of #1050