Line data Source code
1 : // Copyright 2011 The LevelDB-Go and Pebble Authors. All rights reserved. Use 2 : // of this source code is governed by a BSD-style license that can be found in 3 : // the LICENSE file. 4 : 5 : package base 6 : 7 : import "github.com/cockroachdb/errors" 8 : 9 : // ErrNotFound means that a get or delete call did not find the requested key. 10 : var ErrNotFound = errors.New("pebble: not found") 11 : 12 : // ErrCorruption is a marker to indicate that data in a file (WAL, MANIFEST, 13 : // sstable) isn't in the expected format. 14 : var ErrCorruption = errors.New("pebble: corruption") 15 : 16 : // MarkCorruptionError marks given error as a corruption error. 17 1 : func MarkCorruptionError(err error) error { 18 1 : if errors.Is(err, ErrCorruption) { 19 0 : return err 20 0 : } 21 1 : return errors.Mark(err, ErrCorruption) 22 : } 23 : 24 : // CorruptionErrorf formats according to a format specifier and returns 25 : // the string as an error value that is marked as a corruption error. 26 1 : func CorruptionErrorf(format string, args ...interface{}) error { 27 1 : return errors.Mark(errors.Newf(format, args...), ErrCorruption) 28 1 : }