Skip to content

Commit

Permalink
revert comments for deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Apr 8, 2024
1 parent 2f35f37 commit c0c3905
Show file tree
Hide file tree
Showing 24 changed files with 224 additions and 64 deletions.
9 changes: 7 additions & 2 deletions balancers/balancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xstring"
)

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: RoundRobin is an alias to RandomChoice now
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func RoundRobin() *balancerConfig.Config {
return &balancerConfig.Config{}
}
Expand Down Expand Up @@ -113,7 +115,10 @@ type Endpoint interface {
Address() string
Location() string

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: LocalDC check "local" by compare endpoint location with discovery "selflocation" field.
// It work good only if connection url always point to local dc.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
LocalDC() bool
}

Expand Down
8 changes: 6 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ type Option func(c *Config)

// WithInternalDNSResolver
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: always used internal dns-resolver.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithInternalDNSResolver() Option {
return func(c *Config) {}
}
Expand Down Expand Up @@ -170,7 +172,9 @@ func WithApplicationName(applicationName string) Option {

// WithUserAgent add provided user agent to all api requests
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use WithApplicationName instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithUserAgent(userAgent string) Option {
return func(c *Config) {
c.metaOptions = append(c.metaOptions, meta.WithApplicationNameOption(userAgent))
Expand Down
4 changes: 3 additions & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import (
// Connection interface provide access to YDB service clients
// Interface and list of clients may be changed in the future
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use Driver instance instead.
// Will be removed at next major release.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
type Connection interface { //nolint:interfacebloat
// Endpoint returns initial endpoint
Endpoint() string
Expand Down
6 changes: 5 additions & 1 deletion driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ func MustOpen(ctx context.Context, dsn string, opts ...Option) *Driver {

// New connects to database and return driver runtime holder
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use ydb.Open instead.
// New func have no required arguments, such as connection string.
// Thats why we recognize that New have wrong signature.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func New(ctx context.Context, opts ...Option) (_ *Driver, err error) { //nolint:nonamedreturns
d, err := newConnectionFromOptions(ctx, opts...)
if err != nil {
Expand Down
11 changes: 8 additions & 3 deletions internal/endpoint/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ type Info interface {
LastUpdated() time.Time
LoadFactor() float32

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: LocalDC check "local" by compare endpoint location with discovery "selflocation" field.
// It work good only if connection url always point to local dc.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
LocalDC() bool
}

Expand All @@ -35,7 +38,6 @@ type endpoint struct { //nolint:maligned
loadFactor float32
lastUpdated time.Time

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
local bool
}

Expand Down Expand Up @@ -89,7 +91,10 @@ func (e *endpoint) Location() string {
return e.location
}

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: LocalDC check "local" by compare endpoint location with discovery "selflocation" field.
// It work good only if connection url always point to local dc.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func (e *endpoint) LocalDC() bool {
e.mu.RLock()
defer e.mu.RUnlock()
Expand Down
5 changes: 4 additions & 1 deletion internal/mock/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ func (e *Endpoint) Address() string {
return e.AddrField
}

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: LocalDC check "local" by compare endpoint location with discovery "selflocation" field.
// It work good only if connection url always point to local dc.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func (e *Endpoint) LocalDC() bool {
return e.LocalDCField
}
Expand Down
36 changes: 27 additions & 9 deletions internal/table/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ const (
DefaultSessionPoolSizeLimit = 50
DefaultSessionPoolIdleThreshold = 5 * time.Minute

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: table client do not supports background session keep-aliving now.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
DefaultKeepAliveMinSize = 10

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: table client do not supports background session keep-aliving now.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
DefaultIdleKeepAliveThreshold = 2

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: table client do not supports background session keep-aliving now.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
DefaultSessionPoolKeepAliveTimeout = 500 * time.Millisecond
)

Expand Down Expand Up @@ -61,7 +67,9 @@ func WithSizeLimit(sizeLimit int) Option {
// If keepAliveMinSize is less than zero, then no sessions will be preserved
// If keepAliveMinSize is zero, the DefaultKeepAliveMinSize is used
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: table client do not supports background session keep-aliving now.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithKeepAliveMinSize(keepAliveMinSize int) Option {
return func(c *Config) {}
}
Expand All @@ -73,7 +81,9 @@ func WithKeepAliveMinSize(keepAliveMinSize int) Option {
// be removed ever.
// If IdleKeepAliveThreshold is equal to zero, it will be set to DefaultIdleKeepAliveThreshold
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: table client do not supports background session keep-aliving now.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithIdleKeepAliveThreshold(idleKeepAliveThreshold int) Option {
return func(c *Config) {}
}
Expand All @@ -95,7 +105,9 @@ func WithIdleThreshold(idleThreshold time.Duration) Option {
// WithKeepAliveTimeout limits maximum time spent on KeepAlive request
// If keepAliveTimeout is less than or equal to zero then the DefaultSessionPoolKeepAliveTimeout is used.
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: table client do not supports background session keep-aliving now.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithKeepAliveTimeout(keepAliveTimeout time.Duration) Option {
return func(c *Config) {}
}
Expand Down Expand Up @@ -182,7 +194,9 @@ func (c *Config) SizeLimit() int {
// If KeepAliveMinSize is less than zero, then no sessions will be preserved
// If KeepAliveMinSize is zero, the DefaultKeepAliveMinSize is used
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: table client do not supports background session keep-aliving now.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func (c *Config) KeepAliveMinSize() int {
return DefaultKeepAliveMinSize
}
Expand All @@ -199,7 +213,9 @@ func (c *Config) IgnoreTruncated() bool {
// be removed ever.
// If IdleKeepAliveThreshold is equal to zero, it will be set to DefaultIdleKeepAliveThreshold
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: table client do not supports background session keep-aliving now.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func (c *Config) IdleKeepAliveThreshold() int {
return DefaultIdleKeepAliveThreshold
}
Expand All @@ -216,7 +232,9 @@ func (c *Config) IdleThreshold() time.Duration {
// KeepAliveTimeout limits maximum time spent on KeepAlive request
// If KeepAliveTimeout is less than or equal to zero then the DefaultSessionPoolKeepAliveTimeout is used.
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: table client do not supports background session keep-aliving now.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func (c *Config) KeepAliveTimeout() time.Duration {
return DefaultSessionPoolKeepAliveTimeout
}
Expand Down
8 changes: 6 additions & 2 deletions meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ import (

// WithTraceID returns a copy of parent context with traceID
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use meta.WithTraceID instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithTraceID(ctx context.Context, traceID string) context.Context {
return meta.WithTraceID(ctx, traceID)
}

// WithRequestType returns a copy of parent context with custom request type
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use meta.WithRequestType instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithRequestType(ctx context.Context, requestType string) context.Context {
return meta.WithRequestType(ctx, requestType)
}
4 changes: 3 additions & 1 deletion meta/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ func WithTraceID(ctx context.Context, traceID string) context.Context {

// WithUserAgent returns a copy of parent context with custom user-agent info
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use WithApplicationName instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithUserAgent(ctx context.Context, _ string) context.Context {
return ctx
}
Expand Down
12 changes: 9 additions & 3 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ func WithApplicationName(applicationName string) Option {

// WithUserAgent add provided user agent value to all api requests
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use WithApplicationName instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithUserAgent(userAgent string) Option {
return func(ctx context.Context, c *Driver) error {
c.options = append(c.options, config.WithApplicationName(userAgent))
Expand Down Expand Up @@ -434,14 +436,18 @@ func WithSessionPoolDeleteTimeout(deleteTimeout time.Duration) Option {

// WithSessionPoolKeepAliveMinSize set minimum sessions should be keeped alive in table.Client
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use WithApplicationName instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithSessionPoolKeepAliveMinSize(keepAliveMinSize int) Option {
return func(ctx context.Context, c *Driver) error { return nil }
}

// WithSessionPoolKeepAliveTimeout set timeout of keep alive requests for session in table.Client
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use WithApplicationName instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithSessionPoolKeepAliveTimeout(keepAliveTimeout time.Duration) Option {
return func(ctx context.Context, c *Driver) error { return nil }
}
Expand Down
12 changes: 9 additions & 3 deletions retry/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@ type (

// WithIdempotentOperation returns a copy of parent context with idempotent operation feature
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use retry.WithIdempotent option instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithIdempotentOperation(ctx context.Context) context.Context {
return context.WithValue(ctx, ctxIsOperationIdempotentKey{}, true)
}

// WithNonIdempotentOperation returns a copy of parent context with non-idempotent operation feature
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: idempotent flag is false by default.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithNonIdempotentOperation(ctx context.Context) context.Context {
return context.WithValue(ctx, ctxIsOperationIdempotentKey{}, false)
}

// IsOperationIdempotent returns the flag for retry with no idempotent errors
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: context cannot store idempotent value now.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func IsOperationIdempotent(ctx context.Context) bool {
v, ok := ctx.Value(ctxIsOperationIdempotentKey{}).(bool)

Expand Down
8 changes: 6 additions & 2 deletions retry/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ func (retryOptions doRetryOptionsOption) ApplyDoOption(opts *doOptions) {
}

// WithDoRetryOptions specified retry options
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use explicit options instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithDoRetryOptions(opts ...Option) doRetryOptionsOption {
return opts
}
Expand Down Expand Up @@ -102,7 +104,9 @@ func (doTxRetryOptions doTxRetryOptionsOption) ApplyDoTxOption(o *doTxOptions) {
}

// WithDoTxRetryOptions specified retry options
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use explicit options instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithDoTxRetryOptions(opts ...Option) doTxRetryOptionsOption {
return opts
}
Expand Down
7 changes: 5 additions & 2 deletions sugar/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ type constraint interface {

// GenerateDeclareSection generates DECLARE section text in YQL query by params
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use testutil.QueryBind(ydb.WithAutoDeclare()) helper.
// In YDB since version 24.1 declare sections not requires.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func GenerateDeclareSection[T constraint](parameters T) (string, error) {
switch v := any(parameters).(type) {
case *params.Parameters:
Expand All @@ -36,7 +39,7 @@ func GenerateDeclareSection[T constraint](parameters T) (string, error) {

// ToYdbParam converts
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
func ToYdbParam(param sql.NamedArg) (*params.Parameter, error) {
params, err := bind.Params(param)
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion table/options/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ func (kr KeyRange) String() string {
return buf.String()
}

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use TimeToLiveSettings instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
type TTLSettings struct {
DateTimeColumn string
TTLSeconds uint32
Expand Down
17 changes: 12 additions & 5 deletions table/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,9 @@ func WithPartitioningPolicyMode(mode PartitioningMode) PartitioningPolicyOption
}
}

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use WithUniformPartitions instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithPartitioningPolicyUniformPartitions(n uint64) PartitioningPolicyOption {
return func(p *partitioningPolicy, a *allocator.Allocator) {
p.Partitions = &Ydb_Table.PartitioningPolicy_UniformPartitions{
Expand All @@ -527,7 +529,9 @@ func WithPartitioningPolicyUniformPartitions(n uint64) PartitioningPolicyOption
}
}

// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use WithExplicitPartitions instead.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithPartitioningPolicyExplicitPartitions(splitPoints ...value.Value) PartitioningPolicyOption {
return func(p *partitioningPolicy, a *allocator.Allocator) {
values := make([]*Ydb.TypedValue, len(splitPoints))
Expand Down Expand Up @@ -891,8 +895,9 @@ func WithIgnoreTruncated() ExecuteDataQueryOption {

// WithQueryCachePolicyKeepInCache manages keep-in-cache policy
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Use WithKeepInCache for disabling keep-in-cache policy
// Deprecated: data queries always executes with enabled keep-in-cache policy.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithQueryCachePolicyKeepInCache() QueryCachePolicyOption {
return withQueryCachePolicyKeepInCache(true)
}
Expand All @@ -905,7 +910,9 @@ func withQueryCachePolicyKeepInCache(keepInCache bool) QueryCachePolicyOption {

// WithQueryCachePolicy manages query cache policy
//
// Deprecated: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
// Deprecated: use WithKeepInCache for disabling keep-in-cache policy.
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithQueryCachePolicy(opts ...QueryCachePolicyOption) ExecuteDataQueryOption {
return withQueryCachePolicy(opts...)
}
Expand Down
Loading

0 comments on commit c0c3905

Please sign in to comment.