1
0
mirror of https://github.com/taigrr/bitcask synced 2025-01-18 04:03:17 -08:00

move error definition to errors file

This commit is contained in:
Tai Groot 2022-02-06 12:33:52 -08:00
parent 0acd498992
commit 6444849ada
Signed by: taigrr
GPG Key ID: D00C269A87614812
2 changed files with 10 additions and 7 deletions

View File

@ -3,7 +3,6 @@ package bitcask
import ( import (
"bytes" "bytes"
"context" "context"
"errors"
"fmt" "fmt"
"hash/crc32" "hash/crc32"
"io" "io"
@ -34,8 +33,6 @@ const (
ttlIndexFile = "ttl_index" ttlIndexFile = "ttl_index"
) )
var ErrContextDeadlineExceeded = errors.New("Context deadline exceeded.")
// Bitcask is a struct that represents a on-disk LSM and WAL data structure // Bitcask is a struct that represents a on-disk LSM and WAL data structure
// and in-memory hash of key/value pairs as per the Bitcask paper and seen // and in-memory hash of key/value pairs as per the Bitcask paper and seen
// in the Riak database. // in the Riak database.

View File

@ -35,12 +35,17 @@ var (
// ErrInvalidRange is the error returned when the range scan is invalid // ErrInvalidRange is the error returned when the range scan is invalid
ErrInvalidRange = errors.New("error: invalid range") ErrInvalidRange = errors.New("error: invalid range")
// ErrInvalidVersion is the error returned when the database version is invalid // ErrInvalidVersion is the error returned when the database version is
// invalid
ErrInvalidVersion = errors.New("error: invalid db version") ErrInvalidVersion = errors.New("error: invalid db version")
// ErrMergeInProgress is the error returned if merge is called when already a merge // ErrMergeInProgress is the error returned if merge is called when already
// is in progress // a merge is in progress
ErrMergeInProgress = errors.New("error: merge already in progress") ErrMergeInProgress = errors.New("error: merge already in progress")
// ErrContextDeadlineExceeded occurs when a call to bitcask doesn't finish
// before the caller's context Deadline expires
ErrContextDeadlineExceeded = errors.New("Context deadline exceeded.")
) )
// ErrBadConfig is the error returned on failure to load the database config // ErrBadConfig is the error returned on failure to load the database config
@ -59,7 +64,8 @@ func (e *ErrBadConfig) Error() string {
return fmt.Sprintf("error reading config.json: %s", e.Err) return fmt.Sprintf("error reading config.json: %s", e.Err)
} }
// ErrBadMetadata is the error returned on failure to load the database metadata // ErrBadMetadata is the error returned on failure to load the database
// metadata
type ErrBadMetadata struct { type ErrBadMetadata struct {
Err error Err error
} }