Skip to content

Commit

Permalink
support new ydb sdk version (#2511)
Browse files Browse the repository at this point in the history
  • Loading branch information
BarkovBG authored Nov 18, 2024
1 parent b3c6ed5 commit 50a4f78
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cloud/tasks/persistence/ydb.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
persistence_config "github.com/ydb-platform/nbs/cloud/tasks/persistence/config"
"github.com/ydb-platform/ydb-go-sdk/v3"
ydb_credentials "github.com/ydb-platform/ydb-go-sdk/v3/credentials"
"github.com/ydb-platform/ydb-go-sdk/v3/sugar"
ydb_table "github.com/ydb-platform/ydb-go-sdk/v3/table"
ydb_options "github.com/ydb-platform/ydb-go-sdk/v3/table/options"
ydb_result "github.com/ydb-platform/ydb-go-sdk/v3/table/result"
Expand Down Expand Up @@ -691,6 +690,17 @@ func (c *YDBClient) makeDirs(ctx context.Context, absolutePath string) (err erro

////////////////////////////////////////////////////////////////////////////////

func getDSN(config *persistence_config.PersistenceConfig) string {
var protocol string
if config.GetSecure() {
protocol = "grpcs"
} else {
protocol = "grpc"
}

return protocol + "://" + config.GetEndpoint() + "/" + config.GetDatabase()
}

func NewYDBClient(
ctx context.Context,
config *persistence_config.PersistenceConfig,
Expand Down Expand Up @@ -758,7 +768,7 @@ func NewYDBClient(

driver, err := ydb.Open(
ctx,
sugar.DSN(config.GetEndpoint(), config.GetDatabase(), config.GetSecure()),
getDSN(config),
options...,
)
if err != nil {
Expand Down

0 comments on commit 50a4f78

Please sign in to comment.