Convert inline errors to constants

pull/6744/head
Jason Wilder 2016-05-31 10:51:02 -06:00
parent 1ff8ecf4fb
commit d0023dee5d
1 changed files with 10 additions and 5 deletions

View File

@ -31,7 +31,12 @@ const (
TSMFileExtension = "tsm"
)
var errMaxFileExceeded = fmt.Errorf("max file exceeded")
var (
errMaxFileExceeded = fmt.Errorf("max file exceeded")
errSnapshotsDisabled = fmt.Errorf("snapshots disabled")
errCompactionsDisabled = fmt.Errorf("compactions disabled")
errCompactionAborted = fmt.Errorf("compaction aborted")
)
var (
MaxTime = time.Unix(0, math.MaxInt64)
@ -447,7 +452,7 @@ func (c *Compactor) WriteSnapshot(cache *Cache) ([]string, error) {
c.mu.RUnlock()
if !opened {
return nil, fmt.Errorf("snapshots disabled")
return nil, errSnapshotsDisabled
}
iter := NewCacheKeyIterator(cache, tsdb.DefaultMaxPointsPerBlock)
@ -515,7 +520,7 @@ func (c *Compactor) CompactFull(tsmFiles []string) ([]string, error) {
c.mu.RUnlock()
if !opened {
return nil, fmt.Errorf("compactions disabled")
return nil, errCompactionsDisabled
}
return c.compact(false, tsmFiles)
@ -528,7 +533,7 @@ func (c *Compactor) CompactFast(tsmFiles []string) ([]string, error) {
c.mu.RUnlock()
if !opened {
return nil, fmt.Errorf("compactions disabled")
return nil, errCompactionsDisabled
}
return c.compact(true, tsmFiles)
@ -604,7 +609,7 @@ func (c *Compactor) write(path string, iter KeyIterator) (err error) {
select {
case <-c.closing:
c.mu.RUnlock()
return fmt.Errorf("compaction aborted")
return errCompactionAborted
default:
}
c.mu.RUnlock()