Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Commit

Permalink
add MmapError type
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechampine committed Jul 18, 2017
1 parent 657f184 commit b13dff8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion db.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ const (
// default page size for db is set to the OS page size.
var defaultPageSize = os.Getpagesize()

// MmapError represents an error resulting from a failed mmap call. Typically,
// this error means that no further database writes will be possible. The most
// common cause is insufficient disk space.
type MmapError error

// DB represents a collection of buckets persisted to a file on disk.
// All data access is performed through transactions which can be obtained through the DB.
// All the functions on DB will return a ErrDatabaseNotOpen if accessed before Open() is called.
Expand Down Expand Up @@ -280,7 +285,7 @@ func (db *DB) mmap(minsz int) error {
if err2 := mmap(db, db.datasz); err2 != nil {
panic(fmt.Sprintf("failed to revert db size after failed mmap: %v", err2))
}
return err
return MmapError(err)
}

// Save references to the meta pages.
Expand Down

0 comments on commit b13dff8

Please sign in to comment.