mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
9ad5907b48
Former-commit-id: da2423082a10392910bbafcd7683c1c93d7aa556 [formerly 708ea8f31cde627a1b64a5a49c80b5faf571740e] [formerly f127dbccd73fbba2526cb7763c1fafccc926596c [formerly 4558c48cdf
]]
Former-commit-id: c9d4a6c430c6c5f731e755f270bdf66f89eaa646 [formerly 291db3593d93e63d7234d85f49773ec34c867f1e]
Former-commit-id: d1a21b94fe3760e037c7c02a56ca933123a8cae7
72 lines
2.7 KiB
Go
72 lines
2.7 KiB
Go
package bolt
|
|
|
|
import "errors"
|
|
|
|
// These errors can be returned when opening or calling methods on a DB.
|
|
var (
|
|
// ErrDatabaseNotOpen is returned when a DB instance is accessed before it
|
|
// is opened or after it is closed.
|
|
ErrDatabaseNotOpen = errors.New("database not open")
|
|
|
|
// ErrDatabaseOpen is returned when opening a database that is
|
|
// already open.
|
|
ErrDatabaseOpen = errors.New("database already open")
|
|
|
|
// ErrInvalid is returned when both meta pages on a database are invalid.
|
|
// This typically occurs when a file is not a bolt database.
|
|
ErrInvalid = errors.New("invalid database")
|
|
|
|
// ErrVersionMismatch is returned when the data file was created with a
|
|
// different version of Bolt.
|
|
ErrVersionMismatch = errors.New("version mismatch")
|
|
|
|
// ErrChecksum is returned when either meta page checksum does not match.
|
|
ErrChecksum = errors.New("checksum error")
|
|
|
|
// ErrTimeout is returned when a database cannot obtain an exclusive lock
|
|
// on the data file after the timeout passed to Open().
|
|
ErrTimeout = errors.New("timeout")
|
|
)
|
|
|
|
// These errors can occur when beginning or committing a Tx.
|
|
var (
|
|
// ErrTxNotWritable is returned when performing a write operation on a
|
|
// read-only transaction.
|
|
ErrTxNotWritable = errors.New("tx not writable")
|
|
|
|
// ErrTxClosed is returned when committing or rolling back a transaction
|
|
// that has already been committed or rolled back.
|
|
ErrTxClosed = errors.New("tx closed")
|
|
|
|
// ErrDatabaseReadOnly is returned when a mutating transaction is started on a
|
|
// read-only database.
|
|
ErrDatabaseReadOnly = errors.New("database is in read-only mode")
|
|
)
|
|
|
|
// These errors can occur when putting or deleting a value or a bucket.
|
|
var (
|
|
// ErrBucketNotFound is returned when trying to access a bucket that has
|
|
// not been created yet.
|
|
ErrBucketNotFound = errors.New("bucket not found")
|
|
|
|
// ErrBucketExists is returned when creating a bucket that already exists.
|
|
ErrBucketExists = errors.New("bucket already exists")
|
|
|
|
// ErrBucketNameRequired is returned when creating a bucket with a blank name.
|
|
ErrBucketNameRequired = errors.New("bucket name required")
|
|
|
|
// ErrKeyRequired is returned when inserting a zero-length key.
|
|
ErrKeyRequired = errors.New("key required")
|
|
|
|
// ErrKeyTooLarge is returned when inserting a key that is larger than MaxKeySize.
|
|
ErrKeyTooLarge = errors.New("key too large")
|
|
|
|
// ErrValueTooLarge is returned when inserting a value that is larger than MaxValueSize.
|
|
ErrValueTooLarge = errors.New("value too large")
|
|
|
|
// ErrIncompatibleValue is returned when trying create or delete a bucket
|
|
// on an existing non-bucket key or when trying to create or delete a
|
|
// non-bucket key on an existing bucket key.
|
|
ErrIncompatibleValue = errors.New("incompatible value")
|
|
)
|