Minor corrections in comments for xl utils (#4815)

master
Frank Wessels 7 years ago committed by Dee Koder
parent 85fcee1919
commit a2f2044528
  1. 18
      cmd/xl-v1-utils.go

@ -28,7 +28,7 @@ import (
) )
// Returns number of errors that occurred the most (incl. nil) and the // Returns number of errors that occurred the most (incl. nil) and the
// corresponding error value. N B when there is more than one error value that // corresponding error value. NB When there is more than one error value that
// occurs maximum number of times, the error value returned depends on how // occurs maximum number of times, the error value returned depends on how
// golang's map orders keys. This doesn't affect correctness as long as quorum // golang's map orders keys. This doesn't affect correctness as long as quorum
// value is greater than or equal to simple majority, since none of the equally // value is greater than or equal to simple majority, since none of the equally
@ -61,9 +61,9 @@ func reduceErrs(errs []error, ignoredErrs []error) (maxCount int, maxErr error)
// reduceQuorumErrs behaves like reduceErrs by only for returning // reduceQuorumErrs behaves like reduceErrs by only for returning
// values of maximally occurring errors validated against a generic // values of maximally occurring errors validated against a generic
// quorum number can be read or write quorum depending on usage. // quorum number that can be read or write quorum depending on usage.
// additionally a special error is provided as well to be returned // Additionally a special error is provided to be returned in case
// in case quorum is not satisfied. // quorum is not satisfied.
func reduceQuorumErrs(errs []error, ignoredErrs []error, quorum int, quorumErr error) (maxErr error) { func reduceQuorumErrs(errs []error, ignoredErrs []error, quorum int, quorumErr error) (maxErr error) {
maxCount, maxErr := reduceErrs(errs, ignoredErrs) maxCount, maxErr := reduceErrs(errs, ignoredErrs)
if maxErr == nil && maxCount >= quorum { if maxErr == nil && maxCount >= quorum {
@ -91,7 +91,7 @@ func reduceWriteQuorumErrs(errs []error, ignoredErrs []error, writeQuorum int) (
return reduceQuorumErrs(errs, ignoredErrs, writeQuorum, errXLWriteQuorum) return reduceQuorumErrs(errs, ignoredErrs, writeQuorum, errXLWriteQuorum)
} }
// Similar to 'len(slice)' but returns the actual elements count // Similar to 'len(slice)' but returns the actual elements count
// skipping the unallocated elements. // skipping the unallocated elements.
func diskCount(disks []StorageAPI) int { func diskCount(disks []StorageAPI) int {
diskCount := 0 diskCount := 0
@ -104,7 +104,7 @@ func diskCount(disks []StorageAPI) int {
return diskCount return diskCount
} }
// hashOrder - hashes input key to return returns consistent // hashOrder - hashes input key to return consistent
// hashed integer slice. Returned integer order is salted // hashed integer slice. Returned integer order is salted
// with an input key. This results in consistent order. // with an input key. This results in consistent order.
// NOTE: collisions are fine, we are not looking for uniqueness // NOTE: collisions are fine, we are not looking for uniqueness
@ -349,7 +349,7 @@ func shufflePartsMetadata(partsMetadata []xlMetaV1, distribution []int) (shuffle
} }
// shuffleDisks - shuffle input disks slice depending on the // shuffleDisks - shuffle input disks slice depending on the
// erasure distribution. return shuffled slice of disks with // erasure distribution. Return shuffled slice of disks with
// their expected distribution. // their expected distribution.
func shuffleDisks(disks []StorageAPI, distribution []int) (shuffledDisks []StorageAPI) { func shuffleDisks(disks []StorageAPI, distribution []int) (shuffledDisks []StorageAPI) {
if distribution == nil { if distribution == nil {
@ -365,7 +365,7 @@ func shuffleDisks(disks []StorageAPI, distribution []int) (shuffledDisks []Stora
} }
// evalDisks - returns a new slice of disks where nil is set if // evalDisks - returns a new slice of disks where nil is set if
// the correspond error in errs slice is not nil // the corresponding error in errs slice is not nil
func evalDisks(disks []StorageAPI, errs []error) []StorageAPI { func evalDisks(disks []StorageAPI, errs []error) []StorageAPI {
if len(errs) != len(disks) { if len(errs) != len(disks) {
errorIf(errors.New("unexpected disks/errors slice length"), "unable to evaluate internal disks") errorIf(errors.New("unexpected disks/errors slice length"), "unable to evaluate internal disks")
@ -389,7 +389,7 @@ var (
) )
// getPartSizeFromIdx predicts the part size according to its index. It also // getPartSizeFromIdx predicts the part size according to its index. It also
// returns -1 when totalSize is also -1. // returns -1 when totalSize is -1.
func getPartSizeFromIdx(totalSize int64, partSize int64, partIndex int) (int64, error) { func getPartSizeFromIdx(totalSize int64, partSize int64, partIndex int) (int64, error) {
if partSize == 0 { if partSize == 0 {
return 0, traceError(errPartSizeZero) return 0, traceError(errPartSizeZero)

Loading…
Cancel
Save