peers

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 38 Imported by: 4

Documentation

Overview

Package peers implements peers bootstrapping.

Index

Constants

View Source
const (
	// PeersBootstrapperName is the name of the peers bootstrapper
	PeersBootstrapperName = "peers"
)

Variables

View Source
var (
	// DefaultShardConcurrency controls how many shards in parallel to stream
	// for in memory data being streamed between peers (most recent block).
	// Update BootstrapPeersConfiguration comment in
	// src/cmd/services/m3dbnode/config package if this is changed.
	DefaultShardConcurrency = runtime.NumCPU()
	// DefaultShardPersistenceConcurrency controls how many shards in parallel to stream
	// for historical data being streamed between peers (historical blocks).
	// Update BootstrapPeersConfiguration comment in
	// src/cmd/services/m3dbnode/config package if this is changed.
	DefaultShardPersistenceConcurrency = int(math.Max(1, float64(runtime.NumCPU())/2))

	// DefaultShardPersistenceFlushConcurrency controls how many shards in parallel to flush
	// for historical data being streamed between peers (historical blocks).
	// Update BootstrapPeersConfiguration comment in
	// src/cmd/services/m3dbnode/config package if this is changed.
	DefaultShardPersistenceFlushConcurrency = 1
)

Functions

func NewPeersBootstrapperProvider

func NewPeersBootstrapperProvider(
	opts Options,
	next bootstrap.BootstrapperProvider,
) (bootstrap.BootstrapperProvider, error)

NewPeersBootstrapperProvider creates a new bootstrapper provider to bootstrap from peers.

Types

type Options

type Options interface {
	// Validate validates the options.
	Validate() error

	// SetResultOptions sets the instrumentation options.
	SetResultOptions(value result.Options) Options

	// ResultOptions returns the instrumentation options.
	ResultOptions() result.Options

	// SetAdminClient sets the admin client.
	SetAdminClient(value client.AdminClient) Options

	// AdminClient returns the admin client.
	AdminClient() client.AdminClient

	// SetDefaultShardConcurrency sets the concurrency for
	// bootstrapping shards when performing a bootstrap with
	// persistence enabled.
	SetDefaultShardConcurrency(value int) Options

	// DefaultShardConcurrency returns the concurrency for
	// bootstrapping shards when performing a bootstrap with
	// persistence enabled.
	DefaultShardConcurrency() int

	// SetShardPersistenceConcurrency sets the concurrency for
	// bootstrapping shards when performing a bootstrap with
	// persistence enabled.
	SetShardPersistenceConcurrency(value int) Options

	// ShardPersistenceConcurrency returns the concurrency for
	// bootstrapping shards when performing a bootstrap with
	// persistence enabled.
	ShardPersistenceConcurrency() int

	// SetShardPersistenceFlushConcurrency sets the flush concurrency for
	// bootstrapping shards when performing a bootstrap with
	// persistence enabled.
	SetShardPersistenceFlushConcurrency(value int) Options

	// ShardPersistenceFlushConcurrency returns the flush concurrency for
	// bootstrapping shards when performing a bootstrap with
	// persistence enabled.
	ShardPersistenceFlushConcurrency() int

	// SetIndexSegmentConcurrency sets the concurrency for
	// building index segments.
	SetIndexSegmentConcurrency(value int) Options

	// IndexSegmentConcurrency returns the concurrency for
	// building index segments.
	IndexSegmentConcurrency() int

	// SetPersistenceMaxQueueSize sets the max queue for
	// bootstrapping shards waiting in line to persist without blocking
	// the concurrent shard fetchers.
	SetPersistenceMaxQueueSize(value int) Options

	// PersistenceMaxQueueSize returns the max queue for
	// bootstrapping shards waiting in line to persist without blocking
	// the concurrent shard fetchers.
	PersistenceMaxQueueSize() int

	// SetPersistManager sets the persistence manager used to flush blocks
	// when performing a bootstrap with persistence.
	SetPersistManager(value persist.Manager) Options

	// PersistManager returns the persistence manager used to flush blocks
	// when performing a bootstrap with persistence.
	PersistManager() persist.Manager

	// SetIndexClaimsManager sets the index claims manager.
	SetIndexClaimsManager(value fs.IndexClaimsManager) Options

	// IndexClaimsManager returns the index claims manager. It's used to manage
	// concurrent claims for volume indices per ns and block start.
	IndexClaimsManager() fs.IndexClaimsManager

	// SetCompactor sets the compactor used to compact segment builders into segments.
	SetCompactor(value *compaction.Compactor) Options

	// Compactor returns the compactor used to compact segment builders into segments.
	Compactor() *compaction.Compactor

	// SetRuntimeOptionsManagers sets the RuntimeOptionsManager.
	SetRuntimeOptionsManager(value m3dbruntime.OptionsManager) Options

	// RuntimeOptionsManagers returns the RuntimeOptionsManager.
	RuntimeOptionsManager() m3dbruntime.OptionsManager

	// SetContextPool sets the contextPool.
	SetContextPool(value context.Pool) Options

	// ContextPool returns the contextPool.
	ContextPool() context.Pool

	// SetFilesystemOptions sets the filesystem options.
	SetFilesystemOptions(value fs.Options) Options

	// FilesystemOptions returns the filesystem options.
	FilesystemOptions() fs.Options

	// SetIndexOptions set the indexing options.
	SetIndexOptions(value index.Options) Options

	// IndexOptions returns the indexing options.
	IndexOptions() index.Options
}

Options represents the options for bootstrapping from peers.

func NewOptions

func NewOptions() Options

NewOptions creates new bootstrap options.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL