mirror of
https://github.com/luxfi/database.git
synced 2026-10-30 15:01:18 +00:00
- Add //go:build leveldb to all leveldb package files - Add //go:build pebbledb to all pebbledb package files - Refactor factory to use registration pattern - Refactor manager to use registration pattern - badgerdb is now the only default database - Build with -tags=leveldb or -tags=pebbledb to enable them
30 lines
584 B
Go
30 lines
584 B
Go
// Copyright (C) 2020-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
//go:build pebbledb
|
|
|
|
package pebbledb
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/cockroachdb/pebble"
|
|
database "github.com/luxfi/database"
|
|
)
|
|
|
|
var (
|
|
errInvalidOperation = errors.New("invalid operation")
|
|
)
|
|
|
|
// updateError converts a pebble-specific error to its Lux equivalent, if applicable.
|
|
func updateError(err error) error {
|
|
switch err {
|
|
case pebble.ErrClosed:
|
|
return database.ErrClosed
|
|
case pebble.ErrNotFound:
|
|
return database.ErrNotFound
|
|
default:
|
|
return err
|
|
}
|
|
}
|