Files
zapdb/errors.go
T

106 lines
4.7 KiB
Go
Raw Normal View History

2017-09-28 18:54:33 +10:00
/*
* Copyright 2017 Dgraph Labs, Inc. and Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package badger
import (
"github.com/pkg/errors"
)
var (
2017-10-02 18:32:11 +11:00
// ErrValueLogSize is returned when opt.ValueLogFileSize option is not within the valid
// range.
ErrValueLogSize = errors.New("Invalid ValueLogFileSize, must be between 1MB and 2GB")
2018-05-02 06:11:08 -07:00
// ErrValueThreshold is returned when ValueThreshold is set to a value close to or greater than
// uint16.
2019-01-31 17:54:06 +00:00
ErrValueThreshold = errors.New("Invalid ValueThreshold, must be lower than uint16")
2018-05-02 06:11:08 -07:00
2017-10-02 18:32:11 +11:00
// ErrKeyNotFound is returned when key isn't found on a txn.Get.
ErrKeyNotFound = errors.New("Key not found")
// ErrTxnTooBig is returned if too many writes are fit into a single transaction.
2017-10-05 08:42:41 +05:30
ErrTxnTooBig = errors.New("Txn is too big to fit into one request")
2017-10-02 18:32:11 +11:00
// ErrConflict is returned when a transaction conflicts with another transaction. This can happen if
// the read rows had been updated concurrently by another transaction.
2017-10-05 08:42:41 +05:30
ErrConflict = errors.New("Transaction Conflict. Please retry")
2017-10-02 18:32:11 +11:00
// ErrReadOnlyTxn is returned if an update function is called on a read-only transaction.
2017-10-05 08:42:41 +05:30
ErrReadOnlyTxn = errors.New("No sets or deletes are allowed in a read-only transaction")
2017-10-02 18:32:11 +11:00
2017-10-04 18:20:27 +11:00
// ErrDiscardedTxn is returned if a previously discarded transaction is re-used.
2017-10-05 08:42:41 +05:30
ErrDiscardedTxn = errors.New("This transaction has been discarded. Create a new one")
2017-10-04 18:20:27 +11:00
2017-10-02 18:32:11 +11:00
// ErrEmptyKey is returned if an empty key is passed on an update function.
2017-10-05 08:42:41 +05:30
ErrEmptyKey = errors.New("Key cannot be empty")
2017-10-02 18:32:11 +11:00
// ErrInvalidKey is returned if the key has a special !badger! prefix,
// reserved for internal usage.
ErrInvalidKey = errors.New("Key is using a reserved !badger! prefix")
2017-09-28 18:54:33 +10:00
// ErrRetry is returned when a log file containing the value is not found.
// This usually indicates that it may have been garbage collected, and the
// operation needs to be retried.
ErrRetry = errors.New("Unable to find log file. Please retry")
// ErrThresholdZero is returned if threshold is set to zero, and value log GC is called.
// In such a case, GC can't be run.
ErrThresholdZero = errors.New(
"Value log GC can't run because threshold is set to zero")
// ErrNoRewrite is returned if a call for value log GC doesn't result in a log file rewrite.
ErrNoRewrite = errors.New(
"Value log GC attempt didn't result in any cleanup")
// ErrRejected is returned if a value log GC is called either while another GC is running, or
2017-10-04 21:55:56 +11:00
// after DB::Close has been called.
2017-09-28 18:54:33 +10:00
ErrRejected = errors.New("Value log GC request rejected")
// ErrInvalidRequest is returned if the user request is invalid.
ErrInvalidRequest = errors.New("Invalid request")
2017-10-23 16:27:36 +11:00
// ErrManagedTxn is returned if the user tries to use an API which isn't
2017-10-24 08:55:46 +05:30
// allowed due to external management of transactions, when using ManagedDB.
ErrManagedTxn = errors.New(
"Invalid API request. Not allowed to perform this action using ManagedDB")
// ErrInvalidDump if a data dump made previously cannot be loaded into the database.
ErrInvalidDump = errors.New("Data dump cannot be read")
2017-12-11 16:02:56 +11:00
// ErrZeroBandwidth is returned if the user passes in zero bandwidth for sequence.
ErrZeroBandwidth = errors.New("Bandwidth must be greater than zero")
2017-12-06 11:10:54 +05:30
// ErrInvalidLoadingMode is returned when opt.ValueLogLoadingMode option is not
// within the valid range
ErrInvalidLoadingMode = errors.New("Invalid ValueLogLoadingMode, must be FileIO or MemoryMap")
2018-03-07 19:45:33 -08:00
2018-03-07 19:55:42 -08:00
// ErrReplayNeeded is returned when opt.ReadOnly is set but the
2018-03-07 19:45:33 -08:00
// database requires a value log replay.
2018-03-07 19:55:42 -08:00
ErrReplayNeeded = errors.New("Database was not properly closed, cannot open read-only")
2018-03-07 19:45:33 -08:00
// ErrWindowsNotSupported is returned when opt.ReadOnly is used on Windows
ErrWindowsNotSupported = errors.New("Read-only mode is not supported on Windows")
// ErrTruncateNeeded is returned when the value log gets corrupt, and requires truncation of
// corrupt data to allow Badger to run properly.
2018-12-30 11:35:11 -08:00
ErrTruncateNeeded = errors.New("Value log truncate required to run DB. This might result in data loss")
2018-07-12 14:23:49 -07:00
// ErrBlockedWrites is returned if the user called DropAll. During the process of dropping all
// data from Badger, we stop accepting new writes, by returning this error.
2018-12-30 11:35:11 -08:00
ErrBlockedWrites = errors.New("Writes are blocked, possibly due to DropAll or Close")
2017-09-28 18:54:33 +10:00
)