// Copyright (c) HashiCorp, Inc
// SPDX-License-Identifier: MPL-2.0

package wal

import (
	
	

	
	
	
	
)

// WithMetaStore is an option that allows a custom MetaStore to be provided to
// the WAL. If not used the default MetaStore is used.
func ( types.MetaStore) walOpt {
	return func( *WAL) {
		.metaDB = 
	}
}

// WithSegmentFiler is an option that allows a custom SegmentFiler (and hence
// Segment Reader/Writer implementation) to be provided to the WAL. If not used
// the default SegmentFiler is used.
func ( types.SegmentFiler) walOpt {
	return func( *WAL) {
		.sf = 
	}
}

// WithLogger is an option that allows a custom logger to be used.
func ( log.Logger) walOpt {
	return func( *WAL) {
		.logger = 
	}
}

// WithSegmentSize is an option that allows a custom segmentSize to be set.
func ( int) walOpt {
	return func( *WAL) {
		.segmentSize = 
	}
}

// WithMetrics is an option that allows specifying a custom metrics object.
func ( *Metrics) walOpt {
	return func( *WAL) {
		.metrics = 
	}
}

func ( *WAL) () error {
	// Defaults
	if .logger == nil {
		.logger = log.NewNopLogger()
	}
	if .sf == nil {
		// These are not actually swappable via options right now but we override
		// them in tests. Only load the default implementations if they are not set.
		 := fs.New()
		.sf = segment.NewFiler(.dir, )
	}
	if .metrics == nil {
		.metrics = newWALMetrics(prometheus.NewRegistry())
	}
	if .metaDB == nil {
		.metaDB = &metadb.BoltMetaDB{}
	}
	if .segmentSize == 0 {
		.segmentSize = DefaultSegmentSize
	}
	return nil
}