github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/ratelimiter/ratelimiter.go (about)

     1  package ratelimiter
     2  
     3  import (
     4  	"context"
     5  	"time"
     6  
     7  	"github.com/ydb-platform/ydb-go-sdk/v3/internal/ratelimiter/options"
     8  )
     9  
    10  type Client interface {
    11  	CreateResource(
    12  		ctx context.Context,
    13  		coordinationNodePath string,
    14  		resource Resource,
    15  	) (err error)
    16  	AlterResource(
    17  		ctx context.Context,
    18  		coordinationNodePath string,
    19  		resource Resource,
    20  	) (err error)
    21  	DropResource(
    22  		ctx context.Context,
    23  		coordinationNodePath string,
    24  		resourcePath string,
    25  	) (err error)
    26  	ListResource(
    27  		ctx context.Context,
    28  		coordinationNodePath string,
    29  		resourcePath string,
    30  		recursive bool,
    31  	) (_ []string, err error)
    32  	DescribeResource(
    33  		ctx context.Context,
    34  		coordinationNodePath string,
    35  		resourcePath string,
    36  	) (_ *Resource, err error)
    37  	AcquireResource(
    38  		ctx context.Context,
    39  		coordinationNodePath string,
    40  		resourcePath string,
    41  		amount uint64,
    42  		opts ...options.AcquireOption,
    43  	) (err error)
    44  }
    45  
    46  func WithAcquire() options.AcquireOption {
    47  	return options.WithAcquire()
    48  }
    49  
    50  func WithReport() options.AcquireOption {
    51  	return options.WithReport()
    52  }
    53  
    54  func WithOperationTimeout(operationTimeout time.Duration) options.AcquireOption {
    55  	return options.WithOperationTimeout(operationTimeout)
    56  }
    57  
    58  func WithOperationCancelAfter(operationCancelAfter time.Duration) options.AcquireOption {
    59  	return options.WithOperationCancelAfter(operationCancelAfter)
    60  }