boltdb/bolt — pull request #208 by benbjohnson (2014-06-21 20:54:34+00:00)
Title: Add Open() options, flock timeout.

## Overview

This commit changes Open() to provide an additional Options argument. The options argument currently only has a Timeout which will cause the Open() to return `ErrTimeout` if a file lock cannot be obtained in time.

This does cause an API change but I would rather have a solid API going forward than trying to be backwards compatible or cluttering the API with additional functions such as `bolt.OpenWithOptions()`.

## Usage

To use the timeout, simply pass in an `Options` instance pointer:

```go
db, err := bolt.Open("foo.db", 0600, &Options{Timeout: 1 * time.Second})
```

You can also use the default options (i.e. no timeout) by passing in `nil`:

```go
db, err := bolt.Open("foo.db", 0600, nil)
```

### Backwards Compatibility

To update code that uses Bolt, simply pass a `nil` in as the third argument to `bolt.Open()`.

## Notes

The timeout is not currently supported on Windows.

The Linux and Darwin specific files were mostly merged with this command into a single `bolt_unix.go` file using build tags since they were mostly duplicates.

Fixes #207.

/cc @snormore @mkobetic @nathany