mirror of
https://github.com/muun/recovery.git
synced 2025-11-11 06:20:16 -05:00
fix vendor folder
This commit is contained in:
9
vendor/github.com/btcsuite/btcwallet/walletdb/bdb/README.md
generated
vendored
9
vendor/github.com/btcsuite/btcwallet/walletdb/bdb/README.md
generated
vendored
@@ -10,18 +10,19 @@ datastore. Package bdb is licensed under the copyfree ISC license.
|
||||
## Usage
|
||||
|
||||
This package is only a driver to the walletdb package and provides the database
|
||||
type of "bdb". The only parameter the Open and Create functions take is the
|
||||
database path as a string:
|
||||
type of "bdb". The only parameters the Open and Create functions take is the
|
||||
database path as a string, and an option for the database to not sync its
|
||||
freelist to disk as a bool:
|
||||
|
||||
```Go
|
||||
db, err := walletdb.Open("bdb", "path/to/database.db")
|
||||
db, err := walletdb.Open("bdb", "path/to/database.db", true)
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
```Go
|
||||
db, err := walletdb.Create("bdb", "path/to/database.db")
|
||||
db, err := walletdb.Create("bdb", "path/to/database.db", true)
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
4
vendor/github.com/btcsuite/btcwallet/walletdb/bdb/db.go
generated
vendored
4
vendor/github.com/btcsuite/btcwallet/walletdb/bdb/db.go
generated
vendored
@@ -339,7 +339,7 @@ func fileExists(name string) bool {
|
||||
|
||||
// openDB opens the database at the provided path. walletdb.ErrDbDoesNotExist
|
||||
// is returned if the database doesn't exist and the create flag is not set.
|
||||
func openDB(dbPath string, create bool) (walletdb.DB, error) {
|
||||
func openDB(dbPath string, noFreelistSync bool, create bool) (walletdb.DB, error) {
|
||||
if !create && !fileExists(dbPath) {
|
||||
return nil, walletdb.ErrDbDoesNotExist
|
||||
}
|
||||
@@ -347,7 +347,7 @@ func openDB(dbPath string, create bool) (walletdb.DB, error) {
|
||||
// Specify bbolt freelist options to reduce heap pressure in case the
|
||||
// freelist grows to be very large.
|
||||
options := &bbolt.Options{
|
||||
NoFreelistSync: true,
|
||||
NoFreelistSync: noFreelistSync,
|
||||
FreelistType: bbolt.FreelistMapType,
|
||||
}
|
||||
|
||||
|
||||
9
vendor/github.com/btcsuite/btcwallet/walletdb/bdb/doc.go
generated
vendored
9
vendor/github.com/btcsuite/btcwallet/walletdb/bdb/doc.go
generated
vendored
@@ -9,15 +9,16 @@ datastore.
|
||||
Usage
|
||||
|
||||
This package is only a driver to the walletdb package and provides the database
|
||||
type of "bdb". The only parameter the Open and Create functions take is the
|
||||
database path as a string:
|
||||
type of "bdb". The only parameters the Open and Create functions take is the
|
||||
database path as a string, and an option for the database to not sync its
|
||||
freelist to disk as a bool:
|
||||
|
||||
db, err := walletdb.Open("bdb", "path/to/database.db")
|
||||
db, err := walletdb.Open("bdb", "path/to/database.db", true)
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
db, err := walletdb.Create("bdb", "path/to/database.db")
|
||||
db, err := walletdb.Create("bdb", "path/to/database.db", true)
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
31
vendor/github.com/btcsuite/btcwallet/walletdb/bdb/driver.go
generated
vendored
31
vendor/github.com/btcsuite/btcwallet/walletdb/bdb/driver.go
generated
vendored
@@ -15,41 +15,50 @@ const (
|
||||
)
|
||||
|
||||
// parseArgs parses the arguments from the walletdb Open/Create methods.
|
||||
func parseArgs(funcName string, args ...interface{}) (string, error) {
|
||||
if len(args) != 1 {
|
||||
return "", fmt.Errorf("invalid arguments to %s.%s -- "+
|
||||
"expected database path", dbType, funcName)
|
||||
func parseArgs(funcName string, args ...interface{}) (string, bool, error) {
|
||||
if len(args) != 2 {
|
||||
return "", false, fmt.Errorf("invalid arguments to %s.%s -- "+
|
||||
"expected database path and no-freelist-sync option",
|
||||
dbType, funcName)
|
||||
}
|
||||
|
||||
dbPath, ok := args[0].(string)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("first argument to %s.%s is invalid -- "+
|
||||
"expected database path string", dbType, funcName)
|
||||
return "", false, fmt.Errorf("first argument to %s.%s is "+
|
||||
"invalid -- expected database path string", dbType,
|
||||
funcName)
|
||||
}
|
||||
|
||||
return dbPath, nil
|
||||
noFreelistSync, ok := args[1].(bool)
|
||||
if !ok {
|
||||
return "", false, fmt.Errorf("second argument to %s.%s is "+
|
||||
"invalid -- expected no-freelist-sync bool", dbType,
|
||||
funcName)
|
||||
}
|
||||
|
||||
return dbPath, noFreelistSync, nil
|
||||
}
|
||||
|
||||
// openDBDriver is the callback provided during driver registration that opens
|
||||
// an existing database for use.
|
||||
func openDBDriver(args ...interface{}) (walletdb.DB, error) {
|
||||
dbPath, err := parseArgs("Open", args...)
|
||||
dbPath, noFreelistSync, err := parseArgs("Open", args...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return openDB(dbPath, false)
|
||||
return openDB(dbPath, noFreelistSync, false)
|
||||
}
|
||||
|
||||
// createDBDriver is the callback provided during driver registration that
|
||||
// creates, initializes, and opens a database for use.
|
||||
func createDBDriver(args ...interface{}) (walletdb.DB, error) {
|
||||
dbPath, err := parseArgs("Create", args...)
|
||||
dbPath, noFreelistSync, err := parseArgs("Create", args...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return openDB(dbPath, true)
|
||||
return openDB(dbPath, noFreelistSync, true)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
Reference in New Issue
Block a user