Skip to content

Commit

Permalink
Migrate to buf v2 config and update deps (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 authored Jun 19, 2024
1 parent 2fec789 commit 3a40e22
Show file tree
Hide file tree
Showing 13 changed files with 242 additions and 258 deletions.
310 changes: 155 additions & 155 deletions api/duros/v2/durosapiv2.pb.go

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions api/duros/v2/schedule_policy.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions api/duros/v2/statisticsapiv2.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 3 additions & 15 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,8 @@ func init() {
hostRegex = regexp.MustCompile(`^([a-zA-Z0-9.\[\]:%-]+)$`)
}

// Dial creates a LightOS cluster client. it is a blocking call and will only
// return once the connection to [at least one of the] `targets` has been
// actually established - subject to `ctx` limitations. if `ctx` specified
// timeout or duration - dialling (and only dialling!) timeout will be set
// accordingly. `ctx` can also be used to cancel the dialling process, as per
// usual.
//
// the cluster client will make an effort to transparently reconnect to one of
// the `targets` in case of connection loss. if the process of finding a live
// and responsive target amongst `targets` and establishing the connection takes
// longer than the actual operation context timeout (as opposed to the `ctx`
// passed here) - `DeadlineExceeded` will be returned as usual, and the caller
// can retry the operation.
func Dial(ctx context.Context, config DialConfig) (durosv2.DurosAPIClient, error) {
// Dial creates a LightOS cluster client.
func Dial(config DialConfig) (durosv2.DurosAPIClient, error) {
if config.Credentials != nil && config.ByteCredentials != nil {
return nil, status.Errorf(codes.InvalidArgument,
"if you provide credentials, provide either file or byte credentials but not both")
Expand Down Expand Up @@ -185,7 +173,7 @@ func Dial(ctx context.Context, config DialConfig) (durosv2.DurosAPIClient, error
return nil, fmt.Errorf("unsupported scheme:%v", config.Scheme)
}

conn, err := grpc.DialContext(ctx, config.Endpoint, opts...)
conn, err := grpc.NewClient(config.Endpoint, opts...)
if err != nil {
log.Error("failed to connect", "endpoints", config.Endpoint, "error", err.Error())
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func main() {
dialConfig.Credentials = creds
}

durosClient, err := duros.Dial(ctx, dialConfig)
durosClient, err := duros.Dial(dialConfig)
if err != nil {
panic(err)
}
Expand Down
Loading

0 comments on commit 3a40e22

Please sign in to comment.