commitlog

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2019 License: Apache-2.0 Imports: 29 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// CommitLogBootstrapperName is the name of the commit log bootstrapper.
	CommitLogBootstrapperName = "commitlog"
)

Variables

This section is empty.

Functions

func NewCommitLogBootstrapperProvider

func NewCommitLogBootstrapperProvider(
	opts Options,
	inspection fs.Inspection,
	next bootstrap.BootstrapperProvider,
) (bootstrap.BootstrapperProvider, error)

NewCommitLogBootstrapperProvider creates a new bootstrapper provider to bootstrap from commit log files.

Types

type CopyFn added in v0.4.0

type CopyFn func(ident.ID) ident.ID

CopyFn is the copy key function to execute when copying the key.

type EqualsFn added in v0.4.0

type EqualsFn func(ident.ID, ident.ID) bool

EqualsFn is the equals key function to execute when detecting equality of a key.

type FinalizeFn added in v0.4.0

type FinalizeFn func(ident.ID)

FinalizeFn is the finalize key function to execute when finished with a key.

type HashFn added in v0.4.0

type HashFn func(ident.ID) MapHash

HashFn is the hash function to execute when hashing a key.

type Map added in v0.4.0

type Map struct {
	// contains filtered or unexported fields
}

Map uses the genny package to provide a generic hash map that can be specialized by running the following command from this root of the repository: ``` make hashmap-gen pkg=outpkg key_type=Type value_type=Type out_dir=/tmp ``` Or if you would like to use bytes or ident.ID as keys you can use the partially specialized maps to generate your own maps as well: ``` make byteshashmap-gen pkg=outpkg value_type=Type out_dir=/tmp make idhashmap-gen pkg=outpkg value_type=Type out_dir=/tmp ``` This will output to stdout the generated source file to use for your map. It uses linear probing by incrementing the number of the hash created when hashing the identifier if there is a collision. Map is a value type and not an interface to allow for less painful upgrades when adding/removing methods, it is not likely to need mocking so an interface would not be super useful either.

func NewMap added in v0.4.0

func NewMap(opts MapOptions) *Map

NewMap returns a new byte keyed map.

func (*Map) Contains added in v0.4.0

func (m *Map) Contains(k ident.ID) bool

Contains returns true if value exists for key, false otherwise, it is shorthand for a call to Get that doesn't return the value.

func (*Map) Delete added in v0.4.0

func (m *Map) Delete(k ident.ID)

Delete will remove a value set in the map for the specified key.

func (*Map) Get added in v0.4.0

func (m *Map) Get(k ident.ID) (metadataAndEncodersByTime, bool)

Get returns a value in the map for an identifier if found.

func (*Map) Iter added in v0.4.0

func (m *Map) Iter() map[MapHash]MapEntry

Iter provides the underlying map to allow for using a native Go for loop to iterate the map, however callers should only ever read and not write the map.

func (*Map) Len added in v0.4.0

func (m *Map) Len() int

Len returns the number of map entries in the map.

func (*Map) Reallocate added in v0.4.0

func (m *Map) Reallocate()

Reallocate will avoid deleting all keys and reallocate a new map, this is useful if you believe you have a large map and will not need to grow back to a similar size.

func (*Map) Reset added in v0.4.0

func (m *Map) Reset()

Reset will reset the map by simply deleting all keys to avoid allocating a new map.

func (*Map) Set added in v0.4.0

func (m *Map) Set(k ident.ID, v metadataAndEncodersByTime)

Set will set the value for an identifier.

func (*Map) SetUnsafe added in v0.4.0

func (m *Map) SetUnsafe(k ident.ID, v metadataAndEncodersByTime, opts SetUnsafeOptions)

SetUnsafe will set the value for an identifier with unsafe options for how the map treats the key.

type MapEntry added in v0.4.0

type MapEntry struct {
	// contains filtered or unexported fields
}

MapEntry is an entry in the map, this is public to support iterating over the map using a native Go for loop.

func (MapEntry) Key added in v0.4.0

func (e MapEntry) Key() ident.ID

Key returns the map entry key.

func (MapEntry) Value added in v0.4.0

func (e MapEntry) Value() metadataAndEncodersByTime

Value returns the map entry value.

type MapHash added in v0.4.0

type MapHash uint64

MapHash is the hash for a given map entry, this is public to support iterating over the map using a native Go for loop.

type MapOptions added in v0.4.0

type MapOptions struct {
	InitialSize int
	KeyCopyPool pool.BytesPool
}

MapOptions provides options used when created the map.

type Options

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

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

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

	// SetCommitLogOptions sets the commit log options
	SetCommitLogOptions(value commitlog.Options) Options

	// CommitLogOptions returns the commit log options
	CommitLogOptions() commitlog.Options

	// SetEncodingConcurrency sets the concurrency for encoding
	SetEncodingConcurrency(value int) Options

	// EncodingConcurrency returns the concurrency for encoding
	EncodingConcurrency() int

	// SetMergeShardConcurrency sets the concurrency for merging shards
	SetMergeShardsConcurrency(value int) Options

	// MergeShardConcurrency returns the concurrency for merging shards
	MergeShardsConcurrency() int

	// SetReturnUnfulfilledForCorruptCommitLogFiles sets whether the bootstrapper
	// should return unfulfilled if it encounters corrupt commitlog files.
	SetReturnUnfulfilledForCorruptCommitLogFiles(value bool) Options

	// ReturnUnfulfilledForCorruptCommitLogFiles returns whether the bootstrapper
	// should return unfulfilled if it encounters corrupt commitlog files.
	ReturnUnfulfilledForCorruptCommitLogFiles() bool

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

	// RuntimeOptionsManagers returns the RuntimeOptionsManager.
	RuntimeOptionsManager() runtime.OptionsManager
}

Options represents the options for bootstrapping from commit logs

func NewOptions

func NewOptions() Options

NewOptions creates new bootstrap options

type SetUnsafeOptions added in v0.4.0

type SetUnsafeOptions struct {
	NoCopyKey     bool
	NoFinalizeKey bool
}

SetUnsafeOptions is a set of options to use when setting a value with the SetUnsafe method.

Jump to

Keyboard shortcuts

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