Files
zeekay 4c2426c956 factory: register pebbledb under //go:build pebbledb (mirror leveldb)
Makes pebbledb a first-class build-tag-gated backend in the factory, so
consumers no longer need a local registration shim. zapdb stays the always-in
default; leveldb + pebbledb are opt-in via -tags=leveldb / -tags=pebbledb.
2026-06-25 12:18:22 -07:00

31 lines
680 B
Go

// Copyright (C) 2020-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build pebbledb
package factory
import (
"github.com/luxfi/database"
"github.com/luxfi/database/pebbledb"
log "github.com/luxfi/log"
"github.com/luxfi/metric"
)
func init() {
RegisterDatabase(pebbledb.Name, newPebbleDB)
}
func newPebbleDB(
dbPath string,
config []byte,
logger log.Logger,
registerer metric.Registerer,
metricsPrefix string,
readOnly bool,
) (database.Database, error) {
const cacheSize = 12 * 1024 * 1024 // 12 MB block cache
const handleCap = 1024
return pebbledb.New(dbPath, cacheSize, handleCap, pebbledb.Name, readOnly)
}