Source File
options.go
Belonging Package
github.com/polarsignals/wal
// Copyright (c) HashiCorp, Inc// SPDX-License-Identifier: MPL-2.0package walimport ()// 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 {// Defaultsif .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}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |