2016-04-08 13:37:38 -04:00
|
|
|
/*
|
2019-04-09 14:39:42 -04:00
|
|
|
* MinIO Cloud Storage, (C) 2015, 2016 MinIO, Inc.
|
2016-04-08 13:37:38 -04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2016-08-18 19:23:42 -04:00
|
|
|
package cmd
|
2016-04-08 13:37:38 -04:00
|
|
|
|
2017-05-16 17:21:52 -04:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
)
|
2016-04-08 13:37:38 -04:00
|
|
|
|
2016-05-28 18:13:15 -04:00
|
|
|
// errUnexpected - unexpected error, requires manual intervention.
|
|
|
|
var errUnexpected = errors.New("Unexpected error, please report this issue at https://github.com/minio/minio/issues")
|
|
|
|
|
2016-05-20 05:22:22 -04:00
|
|
|
// errCorruptedFormat - corrupted backend format.
|
2019-04-09 14:39:42 -04:00
|
|
|
var errCorruptedFormat = errors.New("corrupted backend format, please join https://slack.min.io for assistance")
|
2016-05-20 05:22:22 -04:00
|
|
|
|
|
|
|
// errUnformattedDisk - unformatted disk found.
|
|
|
|
var errUnformattedDisk = errors.New("unformatted disk found")
|
|
|
|
|
2016-04-19 05:42:10 -04:00
|
|
|
// errDiskFull - cannot create volume or files when disk is full.
|
2016-04-24 03:36:00 -04:00
|
|
|
var errDiskFull = errors.New("disk path full")
|
2016-04-08 13:37:38 -04:00
|
|
|
|
2017-08-11 14:38:46 -04:00
|
|
|
// errDiskNotFound - cannot find the underlying configured disk anymore.
|
2016-05-09 21:57:39 -04:00
|
|
|
var errDiskNotFound = errors.New("disk not found")
|
|
|
|
|
2016-11-20 19:57:12 -05:00
|
|
|
// errFaultyRemoteDisk - remote disk is faulty.
|
|
|
|
var errFaultyRemoteDisk = errors.New("remote disk is faulty")
|
|
|
|
|
|
|
|
// errFaultyDisk - disk is faulty.
|
|
|
|
var errFaultyDisk = errors.New("disk is faulty")
|
|
|
|
|
2016-07-02 04:59:28 -04:00
|
|
|
// errDiskAccessDenied - we don't have write permissions on disk.
|
|
|
|
var errDiskAccessDenied = errors.New("disk access denied")
|
|
|
|
|
2016-04-08 13:37:38 -04:00
|
|
|
// errFileNotFound - cannot find the file.
|
2016-04-24 03:36:00 -04:00
|
|
|
var errFileNotFound = errors.New("file not found")
|
2016-04-08 13:37:38 -04:00
|
|
|
|
2019-05-02 10:09:57 -04:00
|
|
|
// errTooManyOpenFiles - too many open files.
|
|
|
|
var errTooManyOpenFiles = errors.New("too many open files")
|
|
|
|
|
2016-05-11 15:55:02 -04:00
|
|
|
// errFileNameTooLong - given file name is too long than supported length.
|
|
|
|
var errFileNameTooLong = errors.New("file name too long")
|
|
|
|
|
2016-04-08 13:37:38 -04:00
|
|
|
// errVolumeExists - cannot create same volume again.
|
2016-04-24 03:36:00 -04:00
|
|
|
var errVolumeExists = errors.New("volume already exists")
|
2016-04-08 13:37:38 -04:00
|
|
|
|
2016-04-24 03:36:00 -04:00
|
|
|
// errIsNotRegular - not of regular file type.
|
|
|
|
var errIsNotRegular = errors.New("not of regular file type")
|
2016-04-08 13:37:38 -04:00
|
|
|
|
|
|
|
// errVolumeNotFound - cannot find the volume.
|
2016-04-24 03:36:00 -04:00
|
|
|
var errVolumeNotFound = errors.New("volume not found")
|
2016-04-13 14:32:47 -04:00
|
|
|
|
2016-04-16 15:48:41 -04:00
|
|
|
// errVolumeNotEmpty - volume not empty.
|
2016-04-24 03:36:00 -04:00
|
|
|
var errVolumeNotEmpty = errors.New("volume is not empty")
|
2016-04-16 15:48:41 -04:00
|
|
|
|
2016-06-02 19:34:15 -04:00
|
|
|
// errVolumeAccessDenied - cannot access volume, insufficient permissions.
|
2016-04-24 03:36:00 -04:00
|
|
|
var errVolumeAccessDenied = errors.New("volume access denied")
|
2016-04-13 14:32:47 -04:00
|
|
|
|
2019-03-20 16:06:53 -04:00
|
|
|
// errFileAccessDenied - cannot access file, insufficient permissions.
|
2016-04-24 03:36:00 -04:00
|
|
|
var errFileAccessDenied = errors.New("file access denied")
|
2017-05-16 17:21:52 -04:00
|
|
|
|
2019-03-20 16:06:53 -04:00
|
|
|
// errFileParentIsFile - cannot have overlapping objects, parent is already a file.
|
|
|
|
var errFileParentIsFile = errors.New("parent is a file")
|
|
|
|
|
2017-05-16 17:21:52 -04:00
|
|
|
// errBitrotHashAlgoInvalid - the algo for bit-rot hash
|
|
|
|
// verification is empty or invalid.
|
|
|
|
var errBitrotHashAlgoInvalid = errors.New("bit-rot hash algorithm is invalid")
|
|
|
|
|
2017-08-15 18:10:50 -04:00
|
|
|
// errCrossDeviceLink - rename across devices not allowed.
|
|
|
|
var errCrossDeviceLink = errors.New("Rename across devices not allowed, please fix your backend configuration")
|
|
|
|
|
2018-06-28 15:01:05 -04:00
|
|
|
// errMinDiskSize - cannot create volume or files when disk size is less than threshold.
|
|
|
|
var errMinDiskSize = errors.New("The disk size is less than the minimum threshold")
|
|
|
|
|
2018-08-06 18:14:08 -04:00
|
|
|
// errLessData - returned when less data available than what was requested.
|
|
|
|
var errLessData = errors.New("less data available than what was requested")
|
|
|
|
|
2019-01-17 07:58:18 -05:00
|
|
|
// errMoreData = returned when more data was sent by the caller than what it was supposed to.
|
|
|
|
var errMoreData = errors.New("more data was sent than what was advertised")
|
|
|
|
|
2017-05-16 17:21:52 -04:00
|
|
|
// hashMisMatchError - represents a bit-rot hash verification failure
|
|
|
|
// error.
|
|
|
|
type hashMismatchError struct {
|
|
|
|
expected string
|
|
|
|
computed string
|
|
|
|
}
|
|
|
|
|
|
|
|
// error method for the hashMismatchError
|
|
|
|
func (h hashMismatchError) Error() string {
|
|
|
|
return fmt.Sprintf(
|
|
|
|
"Bitrot verification mismatch - expected %v, received %v",
|
|
|
|
h.expected, h.computed)
|
|
|
|
}
|
2017-11-25 14:58:29 -05:00
|
|
|
|
|
|
|
// Collection of basic errors.
|
|
|
|
var baseErrs = []error{
|
|
|
|
errDiskNotFound,
|
|
|
|
errFaultyDisk,
|
|
|
|
errFaultyRemoteDisk,
|
|
|
|
}
|
|
|
|
|
|
|
|
var baseIgnoredErrs = baseErrs
|