-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix scripting package name + add public discovery package
- Loading branch information
1 parent
ba3aedd
commit da80217
Showing
29 changed files
with
305 additions
and
143 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 |
---|---|---|
@@ -1,4 +1,51 @@ | ||
The following authors have created the source code of "Yandex Database GO SDK" | ||
published and distributed by YANDEX LLC as the owner: | ||
|
||
Aleksey Myasnikov <[email protected]> | ||
Alexey Myasnikov [email protected], [email protected] | ||
Sergey Kamardin [email protected] | ||
Nikita Berezhnov [email protected], [email protected] | ||
Andrey Terekhov [email protected] | ||
Andrey Rotchev [email protected] | ||
Alexander Shcherbakov [email protected] | ||
Alexander Izyurov [email protected] | ||
Oleg Doronin [email protected] | ||
Dmitriy Beliakov [email protected] | ||
Daniil Drizhuk [email protected] | ||
Artem Zuikov [email protected] | ||
Daniil Cherednik [email protected] | ||
Vasiliy Gerasimov [email protected] | ||
Sergey Puchin [email protected] | ||
Alexey Borzenkov [email protected] | ||
Ilnaz Nizametdinov [email protected] | ||
Alexander Demidenko [email protected] | ||
Nikolay Perfilov [email protected] | ||
Andrey Haliullin [email protected] | ||
Alexander Shabalin [email protected] | ||
Fedor Korotkiy [email protected] | ||
Sergey Trifonov [email protected] | ||
Andrey Mitrofanov [email protected] | ||
Vitaliy Gridnev [email protected] | ||
Timofey Koolin [email protected], [email protected] | ||
Gleb Borisov [email protected] | ||
Evgeniy Anastasiev [email protected] | ||
Yuriy Chernyshov [email protected] | ||
Anton Kovalenko [email protected] | ||
Sergey Ermolaev [email protected] | ||
Alexey Efimov [email protected] | ||
Damir Makhmutov [email protected] | ||
Marat Mavlyutov [email protected] | ||
Andrey Romashchenko [email protected] | ||
Andrey Krasichkov [email protected] | ||
Dmitriy Sychev [email protected] | ||
Sergey Preis [email protected] | ||
Andrey Kraynov [email protected] | ||
Bulat Hasanov [email protected] | ||
Dmitry Novikov [email protected] | ||
Ilya Sinelnikov [email protected] | ||
Alexander Dmitriev [email protected] | ||
Georgiy Zuikov [email protected] | ||
Maxim Kolganov [email protected] | ||
Arseniy Balabanov [email protected] | ||
Andrey Stolbovsky [email protected] | ||
Alexander Gololobov [email protected] | ||
Vsevolod Strukchinskiy [email protected] |
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
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,42 @@ | ||
package config | ||
|
||
import ( | ||
"context" | ||
"net" | ||
|
||
"google.golang.org/grpc" | ||
"google.golang.org/grpc/credentials" | ||
|
||
"github.com/ydb-platform/ydb-go-sdk/v3/internal/resolver" | ||
"github.com/ydb-platform/ydb-go-sdk/v3/trace" | ||
) | ||
|
||
func (c *config) GrpcDialOptions() (opts []grpc.DialOption) { | ||
// nolint:gocritic | ||
opts = append( | ||
c.grpcOptions, | ||
grpc.WithContextDialer(func(ctx context.Context, address string) (net.Conn, error) { | ||
return newConn(ctx, address, trace.ContextDriver(ctx).Compose(c.trace)) | ||
}), | ||
grpc.WithKeepaliveParams(DefaultGrpcConnectionPolicy), | ||
grpc.WithResolvers( | ||
resolver.New(""), // for use this resolver by default | ||
resolver.New("grpc"), | ||
resolver.New("grpcs"), | ||
), | ||
grpc.WithDefaultServiceConfig(`{"loadBalancingConfig": [{"round_robin":{}}]}`), | ||
grpc.WithDefaultCallOptions( | ||
grpc.MaxCallRecvMsgSize(DefaultGRPCMsgSize), | ||
grpc.MaxCallSendMsgSize(DefaultGRPCMsgSize), | ||
), | ||
grpc.WithBlock(), | ||
) | ||
if c.secure { | ||
opts = append(opts, grpc.WithTransportCredentials( | ||
credentials.NewTLS(c.tlsConfig), | ||
)) | ||
} else { | ||
opts = append(opts, grpc.WithInsecure()) | ||
} | ||
return | ||
} |
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
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,24 @@ | ||
package discovery | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/ydb-platform/ydb-go-sdk/v3/internal/endpoint" | ||
) | ||
|
||
type WhoAmI struct { | ||
User string | ||
Groups []string | ||
} | ||
|
||
func (w WhoAmI) String() string { | ||
return fmt.Sprintf("{User: %s, Groups: [%s]}", w.User, strings.Join(w.Groups, ",")) | ||
} | ||
|
||
type Client interface { | ||
Discover(ctx context.Context) ([]endpoint.Endpoint, error) | ||
WhoAmI(ctx context.Context) (*WhoAmI, error) | ||
Close(ctx context.Context) error | ||
} |
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 |
---|---|---|
@@ -1,52 +1,52 @@ | ||
package single | ||
|
||
import ( | ||
balancer2 "github.com/ydb-platform/ydb-go-sdk/v3/internal/balancer" | ||
"github.com/ydb-platform/ydb-go-sdk/v3/internal/balancer" | ||
"github.com/ydb-platform/ydb-go-sdk/v3/internal/conn" | ||
"github.com/ydb-platform/ydb-go-sdk/v3/internal/endpoint/info" | ||
) | ||
|
||
func Balancer() balancer2.Balancer { | ||
return &balancer{} | ||
func Balancer() balancer.Balancer { | ||
return &single{} | ||
} | ||
|
||
type balancer struct { | ||
type single struct { | ||
conn conn.Conn | ||
} | ||
|
||
func (b *balancer) Create() balancer2.Balancer { | ||
return &balancer{conn: b.conn} | ||
func (b *single) Create() balancer.Balancer { | ||
return &single{conn: b.conn} | ||
} | ||
|
||
func (b *balancer) Next() conn.Conn { | ||
func (b *single) Next() conn.Conn { | ||
return b.conn | ||
} | ||
|
||
func (b *balancer) Insert(conn conn.Conn) balancer2.Element { | ||
func (b *single) Insert(conn conn.Conn) balancer.Element { | ||
if b.conn != nil { | ||
panic("ydb: single Conn Balancer: double Insert()") | ||
} | ||
b.conn = conn | ||
return conn | ||
} | ||
|
||
func (b *balancer) Remove(x balancer2.Element) { | ||
func (b *single) Remove(x balancer.Element) { | ||
if b.conn != x.(conn.Conn) { | ||
panic("ydb: single Conn Balancer: Remove() unknown Conn") | ||
} | ||
b.conn = nil | ||
} | ||
|
||
func (b *balancer) Update(balancer2.Element, info.Info) {} | ||
func (b *single) Update(balancer.Element, info.Info) {} | ||
|
||
func (b *balancer) Contains(x balancer2.Element) bool { | ||
func (b *single) Contains(x balancer.Element) bool { | ||
if x == nil { | ||
return false | ||
} | ||
return b.conn != x.(conn.Conn) | ||
} | ||
|
||
func IsSingle(i interface{}) bool { | ||
_, ok := i.(*balancer) | ||
_, ok := i.(*single) | ||
return ok | ||
} |
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
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
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
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
Oops, something went wrong.