github.com/m3db/m3@v1.5.1-0.20231129193456-75a402aa583b/src/dbnode/client/options.go (about)

     1  // Copyright (c) 2016 Uber Technologies, Inc.
     2  //
     3  // Permission is hereby granted, free of charge, to any person obtaining a copy
     4  // of this software and associated documentation files (the "Software"), to deal
     5  // in the Software without restriction, including without limitation the rights
     6  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     7  // copies of the Software, and to permit persons to whom the Software is
     8  // furnished to do so, subject to the following conditions:
     9  //
    10  // The above copyright notice and this permission notice shall be included in
    11  // all copies or substantial portions of the Software.
    12  //
    13  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    14  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    15  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    16  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    17  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    18  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    19  // THE SOFTWARE.
    20  
    21  package client
    22  
    23  import (
    24  	"errors"
    25  	"math"
    26  	"runtime"
    27  	"time"
    28  
    29  	"github.com/m3db/m3/src/dbnode/encoding"
    30  	"github.com/m3db/m3/src/dbnode/encoding/m3tsz"
    31  	"github.com/m3db/m3/src/dbnode/encoding/proto"
    32  	"github.com/m3db/m3/src/dbnode/environment"
    33  	"github.com/m3db/m3/src/dbnode/generated/thrift/rpc"
    34  	"github.com/m3db/m3/src/dbnode/namespace"
    35  	nchannel "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/node/channel"
    36  	m3dbruntime "github.com/m3db/m3/src/dbnode/runtime"
    37  	"github.com/m3db/m3/src/dbnode/storage/index"
    38  	"github.com/m3db/m3/src/dbnode/topology"
    39  	"github.com/m3db/m3/src/dbnode/x/xio"
    40  	"github.com/m3db/m3/src/x/clock"
    41  	"github.com/m3db/m3/src/x/context"
    42  	"github.com/m3db/m3/src/x/ident"
    43  	"github.com/m3db/m3/src/x/instrument"
    44  	"github.com/m3db/m3/src/x/pool"
    45  	xretry "github.com/m3db/m3/src/x/retry"
    46  	"github.com/m3db/m3/src/x/sampler"
    47  	"github.com/m3db/m3/src/x/serialize"
    48  	xsync "github.com/m3db/m3/src/x/sync"
    49  
    50  	"github.com/uber/tchannel-go"
    51  	"github.com/uber/tchannel-go/thrift"
    52  )
    53  
    54  const (
    55  	// DefaultWriteBatchSize is the default write and write tagged batch size.
    56  	DefaultWriteBatchSize = 128
    57  
    58  	// defaultWriteConsistencyLevel is the default write consistency level
    59  	defaultWriteConsistencyLevel = m3dbruntime.DefaultWriteConsistencyLevel
    60  
    61  	// defaultReadConsistencyLevel is the default read consistency level
    62  	defaultReadConsistencyLevel = m3dbruntime.DefaultReadConsistencyLevel
    63  
    64  	// defaultBootstrapConsistencyLevel is the default bootstrap consistency level
    65  	defaultBootstrapConsistencyLevel = m3dbruntime.DefaultBootstrapConsistencyLevel
    66  
    67  	// defaultMaxConnectionCount is the default max connection count
    68  	defaultMaxConnectionCount = 32
    69  
    70  	// defaultMinConnectionCount is the default min connection count
    71  	defaultMinConnectionCount = 2
    72  
    73  	// defaultHostConnectTimeout is the default host connection timeout
    74  	defaultHostConnectTimeout = 5 * time.Second
    75  
    76  	// defaultClusterConnectTimeout is the default cluster connect timeout
    77  	defaultClusterConnectTimeout = 20 * time.Second
    78  
    79  	// defaultClusterConnectConsistencyLevel is the default cluster connect consistency level
    80  	defaultClusterConnectConsistencyLevel = topology.ConnectConsistencyLevelAny
    81  
    82  	// defaultWriteRequestTimeout is the default write request timeout
    83  	defaultWriteRequestTimeout = 10 * time.Second
    84  
    85  	// defaultFetchRequestTimeout is the default fetch request timeout
    86  	defaultFetchRequestTimeout = 15 * time.Second
    87  
    88  	// defaultTruncateRequestTimeout is the default truncate request timeout
    89  	defaultTruncateRequestTimeout = 60 * time.Second
    90  
    91  	// defaultWriteShardsInitializing is the default write to shards intializing value
    92  	defaultWriteShardsInitializing = true
    93  
    94  	// defaultShardsLeavingCountTowardsConsistency is the default shards leaving count towards consistency
    95  	defaultShardsLeavingCountTowardsConsistency = false
    96  
    97  	// defaultShardsLeavingAndInitializingCountTowardsConsistency is the default shard in leaving and initializing
    98  	// as pair count towards consistency
    99  	defaultShardsLeavingAndInitializingCountTowardsConsistency = false
   100  
   101  	// defaultWriteOpPoolSize is the default write op pool size
   102  	defaultWriteOpPoolSize = 65536
   103  
   104  	// defaultWriteTaggedOpPoolSize is the default write tagged op pool size
   105  	defaultWriteTaggedOpPoolSize = 65536
   106  
   107  	// defaultFetchBatchOpPoolSize is the default fetch op pool size
   108  	defaultFetchBatchOpPoolSize = 1024
   109  
   110  	// defaultFetchBatchSize is the default fetch batch size
   111  	defaultFetchBatchSize = 128
   112  
   113  	// defaultCheckedBytesWrapperPoolSize is the default checkedBytesWrapperPoolSize
   114  	defaultCheckedBytesWrapperPoolSize = 65536
   115  
   116  	// defaultHostQueueOpsFlushSize is the default host queue ops flush size
   117  	defaultHostQueueOpsFlushSize = 128
   118  
   119  	// defaultHostQueueOpsFlushInterval is the default host queue flush interval
   120  	defaultHostQueueOpsFlushInterval = 5 * time.Millisecond
   121  
   122  	// defaultHostQueueOpsArrayPoolSize is the default host queue ops array pool size
   123  	defaultHostQueueOpsArrayPoolSize = 8
   124  
   125  	// defaultHostQueueEmitsHealthStatus is false
   126  	defaultHostQueueEmitsHealthStatus = true
   127  
   128  	// defaultBackgroundConnectInterval is the default background connect interval
   129  	defaultBackgroundConnectInterval = 4 * time.Second
   130  
   131  	// defaultBackgroundConnectStutter is the default background connect stutter
   132  	defaultBackgroundConnectStutter = 2 * time.Second
   133  
   134  	// defaultBackgroundHealthCheckInterval is the default background health check interval
   135  	defaultBackgroundHealthCheckInterval = 4 * time.Second
   136  
   137  	// defaultBackgroundHealthCheckStutter is the default background health check stutter
   138  	defaultBackgroundHealthCheckStutter = 2 * time.Second
   139  
   140  	// defaultBackgroundHealthCheckFailLimit is the default background health failure
   141  	// limit before connection is deemed unhealth
   142  	defaultBackgroundHealthCheckFailLimit = 4
   143  
   144  	// defaultBackgroundHealthCheckFailThrottleFactor is the default throttle factor to
   145  	// apply when calculating how long to wait between a failed health check and a
   146  	// retry attempt. It is applied by multiplying against the host connect
   147  	// timeout to produce a throttle sleep value.
   148  	defaultBackgroundHealthCheckFailThrottleFactor = 0.5
   149  
   150  	// defaultSeriesIteratorPoolSize is the default size of the series iterator pools
   151  	defaultSeriesIteratorPoolSize = 65536
   152  
   153  	// defaultTagEncoderPoolSize is the default size of the tag encoder pool.
   154  	defaultTagEncoderPoolSize = 4096
   155  
   156  	// defaultTagDecoderPoolSize is the default size of the tag decoder pool.
   157  	defaultTagDecoderPoolSize = 4096
   158  
   159  	// defaultFetchSeriesBlocksMaxBlockRetries is the default max retries for fetch series blocks
   160  	// from a single peer
   161  	defaultFetchSeriesBlocksMaxBlockRetries = 2
   162  
   163  	// defaultFetchSeriesBlocksBatchSize is the default fetch series blocks batch size
   164  	defaultFetchSeriesBlocksBatchSize = 4096
   165  
   166  	// defaultFetchSeriesBlocksMetadataBatchTimeout is the default series blocks metadata fetch timeout
   167  	defaultFetchSeriesBlocksMetadataBatchTimeout = 60 * time.Second
   168  
   169  	// defaultFetchSeriesBlocksMetadataBatchTimeout is the default series blocks contents fetch timeout
   170  	defaultFetchSeriesBlocksBatchTimeout = 60 * time.Second
   171  
   172  	// defaultAsyncWriteMaxConcurrency is the default maximum concurrency for async writes.
   173  	defaultAsyncWriteMaxConcurrency = 4096
   174  
   175  	// defaultUseV2BatchAPIs is the default setting for whether the v2 version of the batch APIs should
   176  	// be used.
   177  	defaultUseV2BatchAPIs = false
   178  
   179  	// defaultHostQueueWorkerPoolKillProbability is the default host queue worker pool
   180  	// kill probability.
   181  	defaultHostQueueWorkerPoolKillProbability = 0.01
   182  )
   183  
   184  var (
   185  	// defaultCheckedBytesPoolBucketSizes is the default bytes pool sizes
   186  	// used for both regular bytes pool as well as backs the identifier pool.
   187  	defaultCheckedBytesPoolBucketSizes = []pool.Bucket{
   188  		// Capacity 32 bucket mainly used for allocating for annotations.
   189  		{Capacity: 32, Count: 8192},
   190  		// Capacity 256 bucket mainly used for allocating IDs.
   191  		{Capacity: 256, Count: 8192},
   192  	}
   193  
   194  	// defaultFetchSeriesBlocksBatchConcurrency is the default fetch series blocks in batch parallel concurrency limit
   195  	defaultFetchSeriesBlocksBatchConcurrency = int(math.Max(1, float64(runtime.GOMAXPROCS(0))/2))
   196  
   197  	// defaultWriteRetrier is the default write retrier for write attempts
   198  	defaultWriteRetrier = xretry.NewRetrier(
   199  		xretry.NewOptions().
   200  			SetInitialBackoff(500 * time.Millisecond).
   201  			SetBackoffFactor(3).
   202  			SetMaxRetries(2).
   203  			SetJitter(true))
   204  
   205  	// defaultFetchRetrier is the default fetch retrier for fetch attempts
   206  	defaultFetchRetrier = xretry.NewRetrier(
   207  		xretry.NewOptions().
   208  			SetInitialBackoff(500 * time.Millisecond).
   209  			SetBackoffFactor(2).
   210  			SetMaxRetries(3).
   211  			SetJitter(true))
   212  
   213  	// defaultStreamBlocksRetrier is the default retrier for streaming blocks
   214  	defaultStreamBlocksRetrier = xretry.NewRetrier(
   215  		xretry.NewOptions().
   216  			SetBackoffFactor(2).
   217  			SetMaxRetries(3).
   218  			SetInitialBackoff(2 * time.Second).
   219  			SetJitter(true),
   220  	)
   221  
   222  	// defaultChannelOptions are default tchannel channel options.
   223  	defaultChannelOptions = &tchannel.ChannelOptions{
   224  		MaxIdleTime:       5 * time.Minute,
   225  		IdleCheckInterval: 5 * time.Minute,
   226  	}
   227  
   228  	// defaultThriftContextFn is the default thrift context function.
   229  	defaultThriftContextFn = thrift.Wrap
   230  
   231  	errNoTopologyInitializerSet    = errors.New("no topology initializer set")
   232  	errNoReaderIteratorAllocateSet = errors.New("no reader iterator allocator set, encoding not set")
   233  )
   234  
   235  type options struct {
   236  	runtimeOptsMgr                                      m3dbruntime.OptionsManager
   237  	clockOpts                                           clock.Options
   238  	instrumentOpts                                      instrument.Options
   239  	logHostWriteErrorSampleRate                         sampler.Rate
   240  	logHostFetchErrorSampleRate                         sampler.Rate
   241  	logErrorSampleRate                                  sampler.Rate
   242  	topologyInitializer                                 topology.Initializer
   243  	readConsistencyLevel                                topology.ReadConsistencyLevel
   244  	writeConsistencyLevel                               topology.ConsistencyLevel
   245  	bootstrapConsistencyLevel                           topology.ReadConsistencyLevel
   246  	channelOptions                                      *tchannel.ChannelOptions
   247  	maxConnectionCount                                  int
   248  	minConnectionCount                                  int
   249  	hostConnectTimeout                                  time.Duration
   250  	clusterConnectTimeout                               time.Duration
   251  	clusterConnectConsistencyLevel                      topology.ConnectConsistencyLevel
   252  	writeRequestTimeout                                 time.Duration
   253  	fetchRequestTimeout                                 time.Duration
   254  	truncateRequestTimeout                              time.Duration
   255  	backgroundConnectInterval                           time.Duration
   256  	backgroundConnectStutter                            time.Duration
   257  	backgroundHealthCheckInterval                       time.Duration
   258  	backgroundHealthCheckStutter                        time.Duration
   259  	backgroundHealthCheckFailLimit                      int
   260  	backgroundHealthCheckFailThrottleFactor             float64
   261  	tagEncoderOpts                                      serialize.TagEncoderOptions
   262  	tagEncoderPoolSize                                  pool.Size
   263  	tagDecoderOpts                                      serialize.TagDecoderOptions
   264  	tagDecoderPoolSize                                  pool.Size
   265  	writeRetrier                                        xretry.Retrier
   266  	fetchRetrier                                        xretry.Retrier
   267  	streamBlocksRetrier                                 xretry.Retrier
   268  	writeShardsInitializing                             bool
   269  	shardsLeavingCountTowardsConsistency                bool
   270  	shardsLeavingAndInitializingCountTowardsConsistency bool
   271  	newConnectionFn                                     NewConnectionFn
   272  	readerIteratorAllocate                              encoding.ReaderIteratorAllocate
   273  	writeOperationPoolSize                              pool.Size
   274  	writeTaggedOperationPoolSize                        pool.Size
   275  	fetchBatchOpPoolSize                                pool.Size
   276  	writeBatchSize                                      int
   277  	fetchBatchSize                                      int
   278  	checkedBytesPool                                    pool.CheckedBytesPool
   279  	identifierPool                                      ident.Pool
   280  	hostQueueOpsFlushSize                               int
   281  	hostQueueOpsFlushInterval                           time.Duration
   282  	hostQueueOpsArrayPoolSize                           pool.Size
   283  	hostQueueNewPooledWorkerFn                          xsync.NewPooledWorkerFn
   284  	hostQueueEmitsHealthStatus                          bool
   285  	seriesIteratorPoolSize                              pool.Size
   286  	checkedBytesWrapperPoolSize                         pool.Size
   287  	contextPool                                         context.Pool
   288  	origin                                              topology.Host
   289  	fetchSeriesBlocksMaxBlockRetries                    int
   290  	fetchSeriesBlocksBatchSize                          int
   291  	fetchSeriesBlocksMetadataBatchTimeout               time.Duration
   292  	fetchSeriesBlocksBatchTimeout                       time.Duration
   293  	fetchSeriesBlocksBatchConcurrency                   int
   294  	schemaRegistry                                      namespace.SchemaRegistry
   295  	isProtoEnabled                                      bool
   296  	asyncTopologyInitializers                           []topology.Initializer
   297  	asyncWriteWorkerPool                                xsync.PooledWorkerPool
   298  	asyncWriteMaxConcurrency                            int
   299  	useV2BatchAPIs                                      bool
   300  	iterationOptions                                    index.IterationOptions
   301  	writeTimestampOffset                                time.Duration
   302  	namespaceInitializer                                namespace.Initializer
   303  	thriftContextFn                                     ThriftContextFn
   304  }
   305  
   306  // NewOptions creates a new set of client options with defaults
   307  func NewOptions() Options {
   308  	return newOptions()
   309  }
   310  
   311  // NewAdminOptions creates a new set of administration client options with defaults
   312  func NewAdminOptions() AdminOptions {
   313  	return newOptions()
   314  }
   315  
   316  // NewOptionsForAsyncClusters returns a slice of Options, where each is the set of client
   317  // for a given async client.
   318  func NewOptionsForAsyncClusters(opts Options, topoInits []topology.Initializer, overrides []environment.ClientOverrides) []Options {
   319  	result := make([]Options, 0, len(opts.AsyncTopologyInitializers()))
   320  	for i, topoInit := range topoInits {
   321  		options := opts.SetTopologyInitializer(topoInit)
   322  		if overrides[i].HostQueueFlushInterval != nil {
   323  			options = options.SetHostQueueOpsFlushInterval(*overrides[i].HostQueueFlushInterval)
   324  		}
   325  		if overrides[i].TargetHostQueueFlushSize != nil {
   326  			options = options.SetHostQueueOpsFlushSize(*overrides[i].TargetHostQueueFlushSize)
   327  		}
   328  		result = append(result, options)
   329  	}
   330  	return result
   331  }
   332  
   333  func defaultNewConnectionFn(
   334  	channelName string, address string, clientOpts Options,
   335  ) (Channel, rpc.TChanNode, error) {
   336  	// NB(r): Keep ref to a local channel options since it's actually modified
   337  	// by TChannel itself to set defaults.
   338  	var opts *tchannel.ChannelOptions
   339  	if chanOpts := clientOpts.ChannelOptions(); chanOpts != nil {
   340  		immutableOpts := *chanOpts
   341  		opts = &immutableOpts
   342  	}
   343  	channel, err := tchannel.NewChannel(channelName, opts)
   344  	if err != nil {
   345  		return nil, nil, err
   346  	}
   347  	endpoint := &thrift.ClientOptions{HostPort: address}
   348  	thriftClient := thrift.NewClient(channel, nchannel.ChannelName, endpoint)
   349  	client := rpc.NewTChanNodeClient(thriftClient)
   350  	return channel, client, nil
   351  }
   352  
   353  func newOptions() *options {
   354  	buckets := defaultCheckedBytesPoolBucketSizes
   355  	bytesPool := pool.NewCheckedBytesPool(buckets, nil,
   356  		func(sizes []pool.Bucket) pool.BytesPool {
   357  			return pool.NewBytesPool(sizes, nil)
   358  		})
   359  	bytesPool.Init()
   360  
   361  	idPoolSize := 0
   362  	for _, bucket := range buckets {
   363  		if v := int(bucket.Count); v > idPoolSize {
   364  			idPoolSize = v
   365  		}
   366  	}
   367  
   368  	poolOpts := pool.NewObjectPoolOptions().
   369  		SetSize(idPoolSize)
   370  
   371  	idPool := ident.NewPool(bytesPool, ident.PoolOptions{
   372  		IDPoolOptions:           poolOpts,
   373  		TagsPoolOptions:         poolOpts,
   374  		TagsIteratorPoolOptions: poolOpts,
   375  	})
   376  
   377  	contextPool := context.NewPool(context.NewOptions().
   378  		SetContextPoolOptions(poolOpts).
   379  		SetFinalizerPoolOptions(poolOpts))
   380  
   381  	hostQueueNewPooledWorkerFn := func(
   382  		opts xsync.NewPooledWorkerOptions,
   383  	) (xsync.PooledWorkerPool, error) {
   384  		if opts.InstrumentOptions == nil {
   385  			return nil, errors.New("instrument options required for new pooled worker fn")
   386  		}
   387  
   388  		workerPoolOpts := xsync.NewPooledWorkerPoolOptions().
   389  			SetGrowOnDemand(true).
   390  			SetKillWorkerProbability(defaultHostQueueWorkerPoolKillProbability).
   391  			SetInstrumentOptions(opts.InstrumentOptions)
   392  		return xsync.NewPooledWorkerPool(
   393  			int(workerPoolOpts.NumShards()),
   394  			workerPoolOpts)
   395  	}
   396  
   397  	opts := &options{
   398  		clockOpts:                                           clock.NewOptions(),
   399  		instrumentOpts:                                      instrument.NewOptions(),
   400  		channelOptions:                                      defaultChannelOptions,
   401  		writeConsistencyLevel:                               defaultWriteConsistencyLevel,
   402  		readConsistencyLevel:                                defaultReadConsistencyLevel,
   403  		bootstrapConsistencyLevel:                           defaultBootstrapConsistencyLevel,
   404  		maxConnectionCount:                                  defaultMaxConnectionCount,
   405  		minConnectionCount:                                  defaultMinConnectionCount,
   406  		hostConnectTimeout:                                  defaultHostConnectTimeout,
   407  		clusterConnectTimeout:                               defaultClusterConnectTimeout,
   408  		clusterConnectConsistencyLevel:                      defaultClusterConnectConsistencyLevel,
   409  		writeRequestTimeout:                                 defaultWriteRequestTimeout,
   410  		fetchRequestTimeout:                                 defaultFetchRequestTimeout,
   411  		truncateRequestTimeout:                              defaultTruncateRequestTimeout,
   412  		backgroundConnectInterval:                           defaultBackgroundConnectInterval,
   413  		backgroundConnectStutter:                            defaultBackgroundConnectStutter,
   414  		backgroundHealthCheckInterval:                       defaultBackgroundHealthCheckInterval,
   415  		backgroundHealthCheckStutter:                        defaultBackgroundHealthCheckStutter,
   416  		backgroundHealthCheckFailLimit:                      defaultBackgroundHealthCheckFailLimit,
   417  		backgroundHealthCheckFailThrottleFactor:             defaultBackgroundHealthCheckFailThrottleFactor,
   418  		writeRetrier:                                        defaultWriteRetrier,
   419  		fetchRetrier:                                        defaultFetchRetrier,
   420  		writeShardsInitializing:                             defaultWriteShardsInitializing,
   421  		shardsLeavingCountTowardsConsistency:                defaultShardsLeavingCountTowardsConsistency,
   422  		shardsLeavingAndInitializingCountTowardsConsistency: defaultShardsLeavingAndInitializingCountTowardsConsistency,
   423  		tagEncoderPoolSize:                                  defaultTagEncoderPoolSize,
   424  		tagEncoderOpts:                                      serialize.NewTagEncoderOptions(),
   425  		tagDecoderPoolSize:                                  defaultTagDecoderPoolSize,
   426  		tagDecoderOpts: serialize.
   427  			NewTagDecoderOptions(serialize.TagDecoderOptionsConfig{}),
   428  		streamBlocksRetrier:                   defaultStreamBlocksRetrier,
   429  		newConnectionFn:                       defaultNewConnectionFn,
   430  		writeOperationPoolSize:                defaultWriteOpPoolSize,
   431  		writeTaggedOperationPoolSize:          defaultWriteTaggedOpPoolSize,
   432  		fetchBatchOpPoolSize:                  defaultFetchBatchOpPoolSize,
   433  		writeBatchSize:                        DefaultWriteBatchSize,
   434  		fetchBatchSize:                        defaultFetchBatchSize,
   435  		checkedBytesPool:                      bytesPool,
   436  		identifierPool:                        idPool,
   437  		hostQueueOpsFlushSize:                 defaultHostQueueOpsFlushSize,
   438  		hostQueueOpsFlushInterval:             defaultHostQueueOpsFlushInterval,
   439  		hostQueueOpsArrayPoolSize:             defaultHostQueueOpsArrayPoolSize,
   440  		hostQueueNewPooledWorkerFn:            hostQueueNewPooledWorkerFn,
   441  		hostQueueEmitsHealthStatus:            defaultHostQueueEmitsHealthStatus,
   442  		seriesIteratorPoolSize:                defaultSeriesIteratorPoolSize,
   443  		checkedBytesWrapperPoolSize:           defaultCheckedBytesWrapperPoolSize,
   444  		contextPool:                           contextPool,
   445  		fetchSeriesBlocksMaxBlockRetries:      defaultFetchSeriesBlocksMaxBlockRetries,
   446  		fetchSeriesBlocksBatchSize:            defaultFetchSeriesBlocksBatchSize,
   447  		fetchSeriesBlocksMetadataBatchTimeout: defaultFetchSeriesBlocksMetadataBatchTimeout,
   448  		fetchSeriesBlocksBatchTimeout:         defaultFetchSeriesBlocksBatchTimeout,
   449  		fetchSeriesBlocksBatchConcurrency:     defaultFetchSeriesBlocksBatchConcurrency,
   450  		schemaRegistry:                        namespace.NewSchemaRegistry(false, nil),
   451  		asyncTopologyInitializers:             []topology.Initializer{},
   452  		asyncWriteMaxConcurrency:              defaultAsyncWriteMaxConcurrency,
   453  		useV2BatchAPIs:                        defaultUseV2BatchAPIs,
   454  		thriftContextFn:                       defaultThriftContextFn,
   455  	}
   456  	return opts.SetEncodingM3TSZ().(*options)
   457  }
   458  
   459  func validate(opts *options) error {
   460  	if opts.topologyInitializer == nil {
   461  		return errNoTopologyInitializerSet
   462  	}
   463  	if opts.readerIteratorAllocate == nil {
   464  		return errNoReaderIteratorAllocateSet
   465  	}
   466  	if err := topology.ValidateConsistencyLevel(
   467  		opts.writeConsistencyLevel,
   468  	); err != nil {
   469  		return err
   470  	}
   471  	if err := topology.ValidateReadConsistencyLevel(
   472  		opts.readConsistencyLevel,
   473  	); err != nil {
   474  		return err
   475  	}
   476  	if err := topology.ValidateReadConsistencyLevel(
   477  		opts.bootstrapConsistencyLevel,
   478  	); err != nil {
   479  		return err
   480  	}
   481  	if err := topology.ValidateConnectConsistencyLevel(
   482  		opts.clusterConnectConsistencyLevel,
   483  	); err != nil {
   484  		return err
   485  	}
   486  	if err := opts.logHostWriteErrorSampleRate.Validate(); err != nil {
   487  		return err
   488  	}
   489  	if err := opts.logHostFetchErrorSampleRate.Validate(); err != nil {
   490  		return err
   491  	}
   492  	return opts.logErrorSampleRate.Validate()
   493  }
   494  
   495  func (o *options) Validate() error {
   496  	return validate(o)
   497  }
   498  
   499  func (o *options) SetEncodingM3TSZ() Options {
   500  	opts := *o
   501  	opts.readerIteratorAllocate = m3tsz.DefaultReaderIteratorAllocFn(encoding.NewOptions())
   502  	opts.isProtoEnabled = false
   503  	return &opts
   504  }
   505  
   506  func (o *options) SetEncodingProto(encodingOpts encoding.Options) Options {
   507  	opts := *o
   508  	opts.readerIteratorAllocate = func(
   509  		r xio.Reader64,
   510  		descr namespace.SchemaDescr,
   511  	) encoding.ReaderIterator {
   512  		return proto.NewIterator(r, descr, encodingOpts)
   513  	}
   514  	opts.isProtoEnabled = true
   515  	return &opts
   516  }
   517  
   518  func (o *options) IsSetEncodingProto() bool {
   519  	return o.isProtoEnabled
   520  }
   521  
   522  func (o *options) SetRuntimeOptionsManager(value m3dbruntime.OptionsManager) Options {
   523  	opts := *o
   524  	opts.runtimeOptsMgr = value
   525  	return &opts
   526  }
   527  
   528  func (o *options) RuntimeOptionsManager() m3dbruntime.OptionsManager {
   529  	return o.runtimeOptsMgr
   530  }
   531  
   532  func (o *options) SetClockOptions(value clock.Options) Options {
   533  	opts := *o
   534  	opts.clockOpts = value
   535  	return &opts
   536  }
   537  
   538  func (o *options) ClockOptions() clock.Options {
   539  	return o.clockOpts
   540  }
   541  
   542  func (o *options) SetInstrumentOptions(value instrument.Options) Options {
   543  	opts := *o
   544  	opts.instrumentOpts = value
   545  	return &opts
   546  }
   547  
   548  func (o *options) InstrumentOptions() instrument.Options {
   549  	return o.instrumentOpts
   550  }
   551  
   552  func (o *options) SetLogErrorSampleRate(value sampler.Rate) Options {
   553  	opts := *o
   554  	opts.logErrorSampleRate = value
   555  	return &opts
   556  }
   557  
   558  func (o *options) LogErrorSampleRate() sampler.Rate {
   559  	return o.logErrorSampleRate
   560  }
   561  
   562  func (o *options) SetLogHostWriteErrorSampleRate(value sampler.Rate) Options {
   563  	opts := *o
   564  	opts.logHostWriteErrorSampleRate = value
   565  	return &opts
   566  }
   567  
   568  func (o *options) LogHostWriteErrorSampleRate() sampler.Rate {
   569  	return o.logHostWriteErrorSampleRate
   570  }
   571  
   572  func (o *options) SetLogHostFetchErrorSampleRate(value sampler.Rate) Options {
   573  	opts := *o
   574  	opts.logHostFetchErrorSampleRate = value
   575  	return &opts
   576  }
   577  
   578  func (o *options) LogHostFetchErrorSampleRate() sampler.Rate {
   579  	return o.logHostFetchErrorSampleRate
   580  }
   581  
   582  func (o *options) SetTopologyInitializer(value topology.Initializer) Options {
   583  	opts := *o
   584  	opts.topologyInitializer = value
   585  	return &opts
   586  }
   587  
   588  func (o *options) TopologyInitializer() topology.Initializer {
   589  	return o.topologyInitializer
   590  }
   591  
   592  func (o *options) SetReadConsistencyLevel(value topology.ReadConsistencyLevel) Options {
   593  	opts := *o
   594  	opts.readConsistencyLevel = value
   595  	return &opts
   596  }
   597  
   598  func (o *options) ReadConsistencyLevel() topology.ReadConsistencyLevel {
   599  	return o.readConsistencyLevel
   600  }
   601  
   602  func (o *options) SetWriteConsistencyLevel(value topology.ConsistencyLevel) Options {
   603  	opts := *o
   604  	opts.writeConsistencyLevel = value
   605  	return &opts
   606  }
   607  
   608  func (o *options) WriteConsistencyLevel() topology.ConsistencyLevel {
   609  	return o.writeConsistencyLevel
   610  }
   611  
   612  func (o *options) SetBootstrapConsistencyLevel(value topology.ReadConsistencyLevel) AdminOptions {
   613  	opts := *o
   614  	opts.bootstrapConsistencyLevel = value
   615  	return &opts
   616  }
   617  
   618  func (o *options) BootstrapConsistencyLevel() topology.ReadConsistencyLevel {
   619  	return o.bootstrapConsistencyLevel
   620  }
   621  
   622  func (o *options) SetChannelOptions(value *tchannel.ChannelOptions) Options {
   623  	opts := *o
   624  	opts.channelOptions = value
   625  	return &opts
   626  }
   627  
   628  func (o *options) ChannelOptions() *tchannel.ChannelOptions {
   629  	return o.channelOptions
   630  }
   631  
   632  func (o *options) SetMaxConnectionCount(value int) Options {
   633  	opts := *o
   634  	opts.maxConnectionCount = value
   635  	return &opts
   636  }
   637  
   638  func (o *options) MaxConnectionCount() int {
   639  	return o.maxConnectionCount
   640  }
   641  
   642  func (o *options) SetMinConnectionCount(value int) Options {
   643  	opts := *o
   644  	opts.minConnectionCount = value
   645  	return &opts
   646  }
   647  
   648  func (o *options) MinConnectionCount() int {
   649  	return o.minConnectionCount
   650  }
   651  
   652  func (o *options) SetHostConnectTimeout(value time.Duration) Options {
   653  	opts := *o
   654  	opts.hostConnectTimeout = value
   655  	return &opts
   656  }
   657  
   658  func (o *options) HostConnectTimeout() time.Duration {
   659  	return o.hostConnectTimeout
   660  }
   661  
   662  func (o *options) SetClusterConnectTimeout(value time.Duration) Options {
   663  	opts := *o
   664  	opts.clusterConnectTimeout = value
   665  	return &opts
   666  }
   667  
   668  func (o *options) ClusterConnectTimeout() time.Duration {
   669  	return o.clusterConnectTimeout
   670  }
   671  
   672  func (o *options) SetClusterConnectConsistencyLevel(value topology.ConnectConsistencyLevel) Options {
   673  	opts := *o
   674  	opts.clusterConnectConsistencyLevel = value
   675  	return &opts
   676  }
   677  
   678  func (o *options) ClusterConnectConsistencyLevel() topology.ConnectConsistencyLevel {
   679  	return o.clusterConnectConsistencyLevel
   680  }
   681  
   682  func (o *options) SetWriteRequestTimeout(value time.Duration) Options {
   683  	opts := *o
   684  	opts.writeRequestTimeout = value
   685  	return &opts
   686  }
   687  
   688  func (o *options) WriteRequestTimeout() time.Duration {
   689  	return o.writeRequestTimeout
   690  }
   691  
   692  func (o *options) SetFetchRequestTimeout(value time.Duration) Options {
   693  	opts := *o
   694  	opts.fetchRequestTimeout = value
   695  	return &opts
   696  }
   697  
   698  func (o *options) FetchRequestTimeout() time.Duration {
   699  	return o.fetchRequestTimeout
   700  }
   701  
   702  func (o *options) SetTruncateRequestTimeout(value time.Duration) Options {
   703  	opts := *o
   704  	opts.truncateRequestTimeout = value
   705  	return &opts
   706  }
   707  
   708  func (o *options) TruncateRequestTimeout() time.Duration {
   709  	return o.truncateRequestTimeout
   710  }
   711  
   712  func (o *options) SetBackgroundConnectInterval(value time.Duration) Options {
   713  	opts := *o
   714  	opts.backgroundConnectInterval = value
   715  	return &opts
   716  }
   717  
   718  func (o *options) BackgroundConnectInterval() time.Duration {
   719  	return o.writeRequestTimeout
   720  }
   721  
   722  func (o *options) SetBackgroundConnectStutter(value time.Duration) Options {
   723  	opts := *o
   724  	opts.backgroundConnectStutter = value
   725  	return &opts
   726  }
   727  
   728  func (o *options) BackgroundConnectStutter() time.Duration {
   729  	return o.backgroundConnectStutter
   730  }
   731  
   732  func (o *options) SetBackgroundHealthCheckInterval(value time.Duration) Options {
   733  	opts := *o
   734  	opts.backgroundHealthCheckInterval = value
   735  	return &opts
   736  }
   737  
   738  func (o *options) BackgroundHealthCheckInterval() time.Duration {
   739  	return o.backgroundHealthCheckInterval
   740  }
   741  
   742  func (o *options) SetBackgroundHealthCheckStutter(value time.Duration) Options {
   743  	opts := *o
   744  	opts.backgroundHealthCheckStutter = value
   745  	return &opts
   746  }
   747  
   748  func (o *options) BackgroundHealthCheckStutter() time.Duration {
   749  	return o.backgroundHealthCheckStutter
   750  }
   751  
   752  func (o *options) SetBackgroundHealthCheckFailLimit(value int) Options {
   753  	opts := *o
   754  	opts.backgroundHealthCheckFailLimit = value
   755  	return &opts
   756  }
   757  
   758  func (o *options) BackgroundHealthCheckFailLimit() int {
   759  	return o.backgroundHealthCheckFailLimit
   760  }
   761  
   762  func (o *options) SetBackgroundHealthCheckFailThrottleFactor(value float64) Options {
   763  	opts := *o
   764  	opts.backgroundHealthCheckFailThrottleFactor = value
   765  	return &opts
   766  }
   767  
   768  func (o *options) BackgroundHealthCheckFailThrottleFactor() float64 {
   769  	return o.backgroundHealthCheckFailThrottleFactor
   770  }
   771  
   772  func (o *options) SetWriteRetrier(value xretry.Retrier) Options {
   773  	opts := *o
   774  	opts.writeRetrier = value
   775  	return &opts
   776  }
   777  
   778  func (o *options) WriteRetrier() xretry.Retrier {
   779  	return o.writeRetrier
   780  }
   781  
   782  func (o *options) SetFetchRetrier(value xretry.Retrier) Options {
   783  	opts := *o
   784  	opts.fetchRetrier = value
   785  	return &opts
   786  }
   787  
   788  func (o *options) FetchRetrier() xretry.Retrier {
   789  	return o.fetchRetrier
   790  }
   791  
   792  func (o *options) SetWriteShardsInitializing(value bool) Options {
   793  	opts := *o
   794  	opts.writeShardsInitializing = value
   795  	return &opts
   796  }
   797  
   798  func (o *options) WriteShardsInitializing() bool {
   799  	return o.writeShardsInitializing
   800  }
   801  
   802  func (o *options) SetShardsLeavingCountTowardsConsistency(value bool) Options {
   803  	opts := *o
   804  	opts.shardsLeavingCountTowardsConsistency = value
   805  	return &opts
   806  }
   807  
   808  func (o *options) SetShardsLeavingAndInitializingCountTowardsConsistency(value bool) Options {
   809  	opts := *o
   810  	opts.shardsLeavingAndInitializingCountTowardsConsistency = value
   811  	return &opts
   812  }
   813  
   814  func (o *options) ShardsLeavingCountTowardsConsistency() bool {
   815  	return o.shardsLeavingCountTowardsConsistency
   816  }
   817  
   818  func (o *options) ShardsLeavingAndInitializingCountTowardsConsistency() bool {
   819  	return o.shardsLeavingAndInitializingCountTowardsConsistency
   820  }
   821  
   822  func (o *options) SetTagEncoderOptions(value serialize.TagEncoderOptions) Options {
   823  	opts := *o
   824  	opts.tagEncoderOpts = value
   825  	return &opts
   826  }
   827  
   828  func (o *options) TagEncoderOptions() serialize.TagEncoderOptions {
   829  	return o.tagEncoderOpts
   830  }
   831  
   832  func (o *options) SetTagEncoderPoolSize(value pool.Size) Options {
   833  	opts := *o
   834  	opts.tagEncoderPoolSize = value
   835  	return &opts
   836  }
   837  
   838  func (o *options) TagEncoderPoolSize() pool.Size {
   839  	return o.tagEncoderPoolSize
   840  }
   841  
   842  func (o *options) SetTagDecoderOptions(value serialize.TagDecoderOptions) Options {
   843  	opts := *o
   844  	opts.tagDecoderOpts = value
   845  	return &opts
   846  }
   847  
   848  func (o *options) TagDecoderOptions() serialize.TagDecoderOptions {
   849  	return o.tagDecoderOpts
   850  }
   851  
   852  func (o *options) SetTagDecoderPoolSize(value pool.Size) Options {
   853  	opts := *o
   854  	opts.tagDecoderPoolSize = value
   855  	return &opts
   856  }
   857  
   858  func (o *options) TagDecoderPoolSize() pool.Size {
   859  	return o.tagDecoderPoolSize
   860  }
   861  
   862  func (o *options) SetStreamBlocksRetrier(value xretry.Retrier) AdminOptions {
   863  	opts := *o
   864  	opts.streamBlocksRetrier = value
   865  	return &opts
   866  }
   867  
   868  func (o *options) StreamBlocksRetrier() xretry.Retrier {
   869  	return o.streamBlocksRetrier
   870  }
   871  
   872  func (o *options) SetNewConnectionFn(value NewConnectionFn) AdminOptions {
   873  	opts := *o
   874  	opts.newConnectionFn = value
   875  	return &opts
   876  }
   877  
   878  func (o *options) NewConnectionFn() NewConnectionFn {
   879  	return o.newConnectionFn
   880  }
   881  
   882  func (o *options) SetWriteOpPoolSize(value pool.Size) Options {
   883  	opts := *o
   884  	opts.writeOperationPoolSize = value
   885  	return &opts
   886  }
   887  
   888  func (o *options) WriteOpPoolSize() pool.Size {
   889  	return o.writeOperationPoolSize
   890  }
   891  
   892  func (o *options) SetWriteTaggedOpPoolSize(value pool.Size) Options {
   893  	opts := *o
   894  	opts.writeTaggedOperationPoolSize = value
   895  	return &opts
   896  }
   897  
   898  func (o *options) WriteTaggedOpPoolSize() pool.Size {
   899  	return o.writeTaggedOperationPoolSize
   900  }
   901  
   902  func (o *options) SetFetchBatchOpPoolSize(value pool.Size) Options {
   903  	opts := *o
   904  	opts.fetchBatchOpPoolSize = value
   905  	return &opts
   906  }
   907  
   908  func (o *options) FetchBatchOpPoolSize() pool.Size {
   909  	return o.fetchBatchOpPoolSize
   910  }
   911  
   912  func (o *options) SetContextPool(value context.Pool) Options {
   913  	opts := *o
   914  	opts.contextPool = value
   915  	return &opts
   916  }
   917  
   918  func (o *options) ContextPool() context.Pool {
   919  	return o.contextPool
   920  }
   921  
   922  func (o *options) SetWriteBatchSize(value int) Options {
   923  	opts := *o
   924  	opts.writeBatchSize = value
   925  	return &opts
   926  }
   927  
   928  func (o *options) WriteBatchSize() int {
   929  	return o.writeBatchSize
   930  }
   931  
   932  func (o *options) SetFetchBatchSize(value int) Options {
   933  	opts := *o
   934  	opts.fetchBatchSize = value
   935  	return &opts
   936  }
   937  
   938  func (o *options) FetchBatchSize() int {
   939  	return o.fetchBatchSize
   940  }
   941  
   942  func (o *options) SetCheckedBytesPool(value pool.CheckedBytesPool) Options {
   943  	opts := *o
   944  	opts.checkedBytesPool = value
   945  	return &opts
   946  }
   947  
   948  func (o *options) CheckedBytesPool() pool.CheckedBytesPool {
   949  	return o.checkedBytesPool
   950  }
   951  
   952  func (o *options) SetIdentifierPool(value ident.Pool) Options {
   953  	opts := *o
   954  	opts.identifierPool = value
   955  	return &opts
   956  }
   957  
   958  func (o *options) IdentifierPool() ident.Pool {
   959  	return o.identifierPool
   960  }
   961  
   962  func (o *options) SetCheckedBytesWrapperPoolSize(value pool.Size) Options {
   963  	opts := *o
   964  	opts.checkedBytesWrapperPoolSize = value
   965  	return &opts
   966  }
   967  
   968  func (o *options) CheckedBytesWrapperPoolSize() pool.Size {
   969  	return o.checkedBytesWrapperPoolSize
   970  }
   971  
   972  func (o *options) SetHostQueueOpsFlushSize(value int) Options {
   973  	opts := *o
   974  	opts.hostQueueOpsFlushSize = value
   975  	return &opts
   976  }
   977  
   978  func (o *options) HostQueueOpsFlushSize() int {
   979  	return o.hostQueueOpsFlushSize
   980  }
   981  
   982  func (o *options) SetHostQueueOpsFlushInterval(value time.Duration) Options {
   983  	opts := *o
   984  	opts.hostQueueOpsFlushInterval = value
   985  	return &opts
   986  }
   987  
   988  func (o *options) HostQueueOpsFlushInterval() time.Duration {
   989  	return o.hostQueueOpsFlushInterval
   990  }
   991  
   992  func (o *options) SetHostQueueOpsArrayPoolSize(value pool.Size) Options {
   993  	opts := *o
   994  	opts.hostQueueOpsArrayPoolSize = value
   995  	return &opts
   996  }
   997  
   998  func (o *options) HostQueueOpsArrayPoolSize() pool.Size {
   999  	return o.hostQueueOpsArrayPoolSize
  1000  }
  1001  
  1002  func (o *options) SetHostQueueNewPooledWorkerFn(value xsync.NewPooledWorkerFn) Options {
  1003  	opts := *o
  1004  	opts.hostQueueNewPooledWorkerFn = value
  1005  	return &opts
  1006  }
  1007  
  1008  func (o *options) HostQueueNewPooledWorkerFn() xsync.NewPooledWorkerFn {
  1009  	return o.hostQueueNewPooledWorkerFn
  1010  }
  1011  
  1012  func (o *options) SetHostQueueEmitsHealthStatus(value bool) Options {
  1013  	opts := *o
  1014  	opts.hostQueueEmitsHealthStatus = value
  1015  	return &opts
  1016  }
  1017  
  1018  func (o *options) HostQueueEmitsHealthStatus() bool {
  1019  	return o.hostQueueEmitsHealthStatus
  1020  }
  1021  
  1022  func (o *options) SetSeriesIteratorPoolSize(value pool.Size) Options {
  1023  	opts := *o
  1024  	opts.seriesIteratorPoolSize = value
  1025  	return &opts
  1026  }
  1027  
  1028  func (o *options) SeriesIteratorPoolSize() pool.Size {
  1029  	return o.seriesIteratorPoolSize
  1030  }
  1031  
  1032  func (o *options) SetReaderIteratorAllocate(value encoding.ReaderIteratorAllocate) Options {
  1033  	opts := *o
  1034  	opts.readerIteratorAllocate = value
  1035  	return &opts
  1036  }
  1037  
  1038  func (o *options) ReaderIteratorAllocate() encoding.ReaderIteratorAllocate {
  1039  	return o.readerIteratorAllocate
  1040  }
  1041  
  1042  func (o *options) SetSchemaRegistry(registry namespace.SchemaRegistry) AdminOptions {
  1043  	opts := *o
  1044  	opts.schemaRegistry = registry
  1045  	return &opts
  1046  }
  1047  
  1048  func (o *options) SchemaRegistry() namespace.SchemaRegistry {
  1049  	return o.schemaRegistry
  1050  }
  1051  
  1052  func (o *options) SetOrigin(value topology.Host) AdminOptions {
  1053  	opts := *o
  1054  	opts.origin = value
  1055  	return &opts
  1056  }
  1057  
  1058  func (o *options) Origin() topology.Host {
  1059  	return o.origin
  1060  }
  1061  
  1062  func (o *options) SetFetchSeriesBlocksMaxBlockRetries(value int) AdminOptions {
  1063  	opts := *o
  1064  	opts.fetchSeriesBlocksMaxBlockRetries = value
  1065  	return &opts
  1066  }
  1067  
  1068  func (o *options) FetchSeriesBlocksMaxBlockRetries() int {
  1069  	return o.fetchSeriesBlocksMaxBlockRetries
  1070  }
  1071  
  1072  func (o *options) SetFetchSeriesBlocksBatchSize(value int) AdminOptions {
  1073  	opts := *o
  1074  	opts.fetchSeriesBlocksBatchSize = value
  1075  	return &opts
  1076  }
  1077  
  1078  func (o *options) FetchSeriesBlocksBatchSize() int {
  1079  	return o.fetchSeriesBlocksBatchSize
  1080  }
  1081  
  1082  func (o *options) SetFetchSeriesBlocksMetadataBatchTimeout(value time.Duration) AdminOptions {
  1083  	opts := *o
  1084  	opts.fetchSeriesBlocksMetadataBatchTimeout = value
  1085  	return &opts
  1086  }
  1087  
  1088  func (o *options) FetchSeriesBlocksMetadataBatchTimeout() time.Duration {
  1089  	return o.fetchSeriesBlocksMetadataBatchTimeout
  1090  }
  1091  
  1092  func (o *options) SetFetchSeriesBlocksBatchTimeout(value time.Duration) AdminOptions {
  1093  	opts := *o
  1094  	opts.fetchSeriesBlocksBatchTimeout = value
  1095  	return &opts
  1096  }
  1097  
  1098  func (o *options) FetchSeriesBlocksBatchTimeout() time.Duration {
  1099  	return o.fetchSeriesBlocksBatchTimeout
  1100  }
  1101  
  1102  func (o *options) SetFetchSeriesBlocksBatchConcurrency(value int) AdminOptions {
  1103  	opts := *o
  1104  	opts.fetchSeriesBlocksBatchConcurrency = value
  1105  	return &opts
  1106  }
  1107  
  1108  func (o *options) FetchSeriesBlocksBatchConcurrency() int {
  1109  	return o.fetchSeriesBlocksBatchConcurrency
  1110  }
  1111  
  1112  func (o *options) SetAsyncTopologyInitializers(value []topology.Initializer) Options {
  1113  	opts := *o
  1114  	opts.asyncTopologyInitializers = value
  1115  	return &opts
  1116  }
  1117  
  1118  func (o *options) AsyncTopologyInitializers() []topology.Initializer {
  1119  	return o.asyncTopologyInitializers
  1120  }
  1121  
  1122  func (o *options) SetAsyncWriteWorkerPool(value xsync.PooledWorkerPool) Options {
  1123  	opts := *o
  1124  	opts.asyncWriteWorkerPool = value
  1125  	return &opts
  1126  }
  1127  
  1128  func (o *options) AsyncWriteWorkerPool() xsync.PooledWorkerPool {
  1129  	return o.asyncWriteWorkerPool
  1130  }
  1131  
  1132  func (o *options) SetAsyncWriteMaxConcurrency(value int) Options {
  1133  	opts := *o
  1134  	opts.asyncWriteMaxConcurrency = value
  1135  	return &opts
  1136  }
  1137  
  1138  func (o *options) AsyncWriteMaxConcurrency() int {
  1139  	return o.asyncWriteMaxConcurrency
  1140  }
  1141  
  1142  func (o *options) SetUseV2BatchAPIs(value bool) Options {
  1143  	opts := *o
  1144  	opts.useV2BatchAPIs = value
  1145  	return &opts
  1146  }
  1147  
  1148  func (o *options) UseV2BatchAPIs() bool {
  1149  	return o.useV2BatchAPIs
  1150  }
  1151  
  1152  func (o *options) SetIterationOptions(value index.IterationOptions) Options {
  1153  	opts := *o
  1154  	opts.iterationOptions = value
  1155  	return &opts
  1156  }
  1157  
  1158  func (o *options) IterationOptions() index.IterationOptions {
  1159  	return o.iterationOptions
  1160  }
  1161  
  1162  func (o *options) SetWriteTimestampOffset(value time.Duration) AdminOptions {
  1163  	opts := *o
  1164  	opts.writeTimestampOffset = value
  1165  	return &opts
  1166  }
  1167  
  1168  func (o *options) WriteTimestampOffset() time.Duration {
  1169  	return o.writeTimestampOffset
  1170  }
  1171  
  1172  func (o *options) SetNamespaceInitializer(value namespace.Initializer) Options {
  1173  	opts := *o
  1174  	opts.namespaceInitializer = value
  1175  	return &opts
  1176  }
  1177  
  1178  func (o *options) NamespaceInitializer() namespace.Initializer {
  1179  	return o.namespaceInitializer
  1180  }
  1181  
  1182  func (o *options) SetThriftContextFn(value ThriftContextFn) Options {
  1183  	opts := *o
  1184  	opts.thriftContextFn = value
  1185  	return &opts
  1186  }
  1187  
  1188  func (o *options) ThriftContextFn() ThriftContextFn {
  1189  	return o.thriftContextFn
  1190  }