1717package badger
1818
1919import (
20+ stderrors "errors"
2021 "math"
21-
22- "github.com/pkg/errors"
2322)
2423
2524const (
@@ -30,97 +29,97 @@ const (
3029var (
3130 // ErrValueLogSize is returned when opt.ValueLogFileSize option is not within the valid
3231 // range.
33- ErrValueLogSize = errors .New ("Invalid ValueLogFileSize, must be in range [1MB, 2GB)" )
32+ ErrValueLogSize = stderrors .New ("Invalid ValueLogFileSize, must be in range [1MB, 2GB)" )
3433
3534 // ErrKeyNotFound is returned when key isn't found on a txn.Get.
36- ErrKeyNotFound = errors .New ("Key not found" )
35+ ErrKeyNotFound = stderrors .New ("Key not found" )
3736
3837 // ErrTxnTooBig is returned if too many writes are fit into a single transaction.
39- ErrTxnTooBig = errors .New ("Txn is too big to fit into one request" )
38+ ErrTxnTooBig = stderrors .New ("Txn is too big to fit into one request" )
4039
4140 // ErrConflict is returned when a transaction conflicts with another transaction. This can
4241 // happen if the read rows had been updated concurrently by another transaction.
43- ErrConflict = errors .New ("Transaction Conflict. Please retry" )
42+ ErrConflict = stderrors .New ("Transaction Conflict. Please retry" )
4443
4544 // ErrReadOnlyTxn is returned if an update function is called on a read-only transaction.
46- ErrReadOnlyTxn = errors .New ("No sets or deletes are allowed in a read-only transaction" )
45+ ErrReadOnlyTxn = stderrors .New ("No sets or deletes are allowed in a read-only transaction" )
4746
4847 // ErrDiscardedTxn is returned if a previously discarded transaction is re-used.
49- ErrDiscardedTxn = errors .New ("This transaction has been discarded. Create a new one" )
48+ ErrDiscardedTxn = stderrors .New ("This transaction has been discarded. Create a new one" )
5049
5150 // ErrEmptyKey is returned if an empty key is passed on an update function.
52- ErrEmptyKey = errors .New ("Key cannot be empty" )
51+ ErrEmptyKey = stderrors .New ("Key cannot be empty" )
5352
5453 // ErrInvalidKey is returned if the key has a special !badger! prefix,
5554 // reserved for internal usage.
56- ErrInvalidKey = errors .New ("Key is using a reserved !badger! prefix" )
55+ ErrInvalidKey = stderrors .New ("Key is using a reserved !badger! prefix" )
5756
5857 // ErrBannedKey is returned if the read/write key belongs to any banned namespace.
59- ErrBannedKey = errors .New ("Key is using the banned prefix" )
58+ ErrBannedKey = stderrors .New ("Key is using the banned prefix" )
6059
6160 // ErrThresholdZero is returned if threshold is set to zero, and value log GC is called.
6261 // In such a case, GC can't be run.
63- ErrThresholdZero = errors .New (
62+ ErrThresholdZero = stderrors .New (
6463 "Value log GC can't run because threshold is set to zero" )
6564
6665 // ErrNoRewrite is returned if a call for value log GC doesn't result in a log file rewrite.
67- ErrNoRewrite = errors .New (
66+ ErrNoRewrite = stderrors .New (
6867 "Value log GC attempt didn't result in any cleanup" )
6968
7069 // ErrRejected is returned if a value log GC is called either while another GC is running, or
7170 // after DB::Close has been called.
72- ErrRejected = errors .New ("Value log GC request rejected" )
71+ ErrRejected = stderrors .New ("Value log GC request rejected" )
7372
7473 // ErrInvalidRequest is returned if the user request is invalid.
75- ErrInvalidRequest = errors .New ("Invalid request" )
74+ ErrInvalidRequest = stderrors .New ("Invalid request" )
7675
7776 // ErrManagedTxn is returned if the user tries to use an API which isn't
7877 // allowed due to external management of transactions, when using ManagedDB.
79- ErrManagedTxn = errors .New (
78+ ErrManagedTxn = stderrors .New (
8079 "Invalid API request. Not allowed to perform this action using ManagedDB" )
8180
8281 // ErrNamespaceMode is returned if the user tries to use an API which is allowed only when
8382 // NamespaceOffset is non-negative.
84- ErrNamespaceMode = errors .New (
83+ ErrNamespaceMode = stderrors .New (
8584 "Invalid API request. Not allowed to perform this action when NamespaceMode is not set." )
8685
8786 // ErrInvalidDump if a data dump made previously cannot be loaded into the database.
88- ErrInvalidDump = errors .New ("Data dump cannot be read" )
87+ ErrInvalidDump = stderrors .New ("Data dump cannot be read" )
8988
9089 // ErrZeroBandwidth is returned if the user passes in zero bandwidth for sequence.
91- ErrZeroBandwidth = errors .New ("Bandwidth must be greater than zero" )
90+ ErrZeroBandwidth = stderrors .New ("Bandwidth must be greater than zero" )
9291
9392 // ErrWindowsNotSupported is returned when opt.ReadOnly is used on Windows
94- ErrWindowsNotSupported = errors .New ("Read-only mode is not supported on Windows" )
93+ ErrWindowsNotSupported = stderrors .New ("Read-only mode is not supported on Windows" )
9594
9695 // ErrPlan9NotSupported is returned when opt.ReadOnly is used on Plan 9
97- ErrPlan9NotSupported = errors .New ("Read-only mode is not supported on Plan 9" )
96+ ErrPlan9NotSupported = stderrors .New ("Read-only mode is not supported on Plan 9" )
9897
9998 // ErrTruncateNeeded is returned when the value log gets corrupt, and requires truncation of
10099 // corrupt data to allow Badger to run properly.
101- ErrTruncateNeeded = errors .New (
100+ ErrTruncateNeeded = stderrors .New (
102101 "Log truncate required to run DB. This might result in data loss" )
103102
104103 // ErrBlockedWrites is returned if the user called DropAll. During the process of dropping all
105104 // data from Badger, we stop accepting new writes, by returning this error.
106- ErrBlockedWrites = errors .New ("Writes are blocked, possibly due to DropAll or Close" )
105+ ErrBlockedWrites = stderrors .New ("Writes are blocked, possibly due to DropAll or Close" )
107106
108107 // ErrNilCallback is returned when subscriber's callback is nil.
109- ErrNilCallback = errors .New ("Callback cannot be nil" )
108+ ErrNilCallback = stderrors .New ("Callback cannot be nil" )
110109
111110 // ErrEncryptionKeyMismatch is returned when the storage key is not
112111 // matched with the key previously given.
113- ErrEncryptionKeyMismatch = errors .New ("Encryption key mismatch" )
112+ ErrEncryptionKeyMismatch = stderrors .New ("Encryption key mismatch" )
114113
115114 // ErrInvalidDataKeyID is returned if the datakey id is invalid.
116- ErrInvalidDataKeyID = errors .New ("Invalid datakey id" )
115+ ErrInvalidDataKeyID = stderrors .New ("Invalid datakey id" )
117116
118117 // ErrInvalidEncryptionKey is returned if length of encryption keys is invalid.
119- ErrInvalidEncryptionKey = errors .New ("Encryption key's length should be" +
118+ ErrInvalidEncryptionKey = stderrors .New ("Encryption key's length should be" +
120119 "either 16, 24, or 32 bytes" )
121120 // ErrGCInMemoryMode is returned when db.RunValueLogGC is called in in-memory mode.
122- ErrGCInMemoryMode = errors .New ("Cannot run value log GC when DB is opened in InMemory mode" )
121+ ErrGCInMemoryMode = stderrors .New ("Cannot run value log GC when DB is opened in InMemory mode" )
123122
124123 // ErrDBClosed is returned when a get operation is performed after closing the DB.
125- ErrDBClosed = errors .New ("DB Closed" )
124+ ErrDBClosed = stderrors .New ("DB Closed" )
126125)
0 commit comments