本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.7KB

  1. package bbolt
  2. import "errors"
  3. // These errors can be returned when opening or calling methods on a DB.
  4. var (
  5. // ErrDatabaseNotOpen is returned when a DB instance is accessed before it
  6. // is opened or after it is closed.
  7. ErrDatabaseNotOpen = errors.New("database not open")
  8. // ErrDatabaseOpen is returned when opening a database that is
  9. // already open.
  10. ErrDatabaseOpen = errors.New("database already open")
  11. // ErrInvalid is returned when both meta pages on a database are invalid.
  12. // This typically occurs when a file is not a bolt database.
  13. ErrInvalid = errors.New("invalid database")
  14. // ErrVersionMismatch is returned when the data file was created with a
  15. // different version of Bolt.
  16. ErrVersionMismatch = errors.New("version mismatch")
  17. // ErrChecksum is returned when either meta page checksum does not match.
  18. ErrChecksum = errors.New("checksum error")
  19. // ErrTimeout is returned when a database cannot obtain an exclusive lock
  20. // on the data file after the timeout passed to Open().
  21. ErrTimeout = errors.New("timeout")
  22. )
  23. // These errors can occur when beginning or committing a Tx.
  24. var (
  25. // ErrTxNotWritable is returned when performing a write operation on a
  26. // read-only transaction.
  27. ErrTxNotWritable = errors.New("tx not writable")
  28. // ErrTxClosed is returned when committing or rolling back a transaction
  29. // that has already been committed or rolled back.
  30. ErrTxClosed = errors.New("tx closed")
  31. // ErrDatabaseReadOnly is returned when a mutating transaction is started on a
  32. // read-only database.
  33. ErrDatabaseReadOnly = errors.New("database is in read-only mode")
  34. )
  35. // These errors can occur when putting or deleting a value or a bucket.
  36. var (
  37. // ErrBucketNotFound is returned when trying to access a bucket that has
  38. // not been created yet.
  39. ErrBucketNotFound = errors.New("bucket not found")
  40. // ErrBucketExists is returned when creating a bucket that already exists.
  41. ErrBucketExists = errors.New("bucket already exists")
  42. // ErrBucketNameRequired is returned when creating a bucket with a blank name.
  43. ErrBucketNameRequired = errors.New("bucket name required")
  44. // ErrKeyRequired is returned when inserting a zero-length key.
  45. ErrKeyRequired = errors.New("key required")
  46. // ErrKeyTooLarge is returned when inserting a key that is larger than MaxKeySize.
  47. ErrKeyTooLarge = errors.New("key too large")
  48. // ErrValueTooLarge is returned when inserting a value that is larger than MaxValueSize.
  49. ErrValueTooLarge = errors.New("value too large")
  50. // ErrIncompatibleValue is returned when trying create or delete a bucket
  51. // on an existing non-bucket key or when trying to create or delete a
  52. // non-bucket key on an existing bucket key.
  53. ErrIncompatibleValue = errors.New("incompatible value")
  54. )
上海开阖软件有限公司 沪ICP备12045867号-1