mirror of
https://github.com/luxfi/database.git
synced 2026-10-30 15:01:18 +00:00
29 lines
699 B
Go
29 lines
699 B
Go
// Copyright (C) 2020-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
//go:build leveldb
|
|
|
|
package manager
|
|
|
|
import (
|
|
db "github.com/luxfi/database"
|
|
"github.com/luxfi/database/leveldb"
|
|
"github.com/luxfi/metric"
|
|
)
|
|
|
|
func init() {
|
|
RegisterDatabaseType("leveldb", func(path string, config *Config, registerer metric.Registerer) (db.Database, error) {
|
|
return leveldb.New(path, config.CacheSize, config.CacheSize/2, config.HandleCap)
|
|
})
|
|
}
|
|
|
|
// DefaultLevelDBConfig returns a default LevelDB configuration.
|
|
func DefaultLevelDBConfig(path string) *Config {
|
|
return &Config{
|
|
Type: "leveldb",
|
|
Path: path,
|
|
CacheSize: 16,
|
|
HandleCap: 1024,
|
|
}
|
|
}
|