github.com/TeaOSLab/EdgeNode@v1.3.8/internal/utils/kvstore/errors.go (about) 1 // Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . 2 3 package kvstore 4 5 import ( 6 "errors" 7 "fmt" 8 "github.com/cockroachdb/pebble" 9 ) 10 11 var ErrTableNotFound = errors.New("table not found") 12 var ErrKeyTooLong = errors.New("too long key") 13 var ErrSkip = errors.New("skip") // skip count in iterator 14 var ErrTableClosed = errors.New("table closed") 15 16 func IsNotFound(err error) bool { 17 return err != nil && errors.Is(err, pebble.ErrNotFound) 18 } 19 20 func IsSkipError(err error) bool { 21 return err != nil && errors.Is(err, ErrSkip) 22 } 23 24 func Skip() (bool, error) { 25 return true, ErrSkip 26 } 27 28 func NewTableClosedErr(tableName string) error { 29 return fmt.Errorf("table '"+tableName+"' closed: %w", ErrTableClosed) 30 }