diff --git a/node/node.go b/node/node.go
index f4c7d8c726a3d5f24b848f1475d25f8bcb4d3c81..ff2244503fef1a7d3671c87167ad35604cc29aff 100644
--- a/node/node.go
+++ b/node/node.go
@@ -34,7 +34,7 @@ import (
 	"github.com/ethereum/go-ethereum/log"
 	"github.com/ethereum/go-ethereum/p2p"
 	"github.com/ethereum/go-ethereum/rpc"
-	"github.com/prometheus/prometheus/util/flock"
+	"github.com/prometheus/tsdb/fileutil"
 )
 
 // Node is a container on which services can be registered.
@@ -43,8 +43,8 @@ type Node struct {
 	config   *Config
 	accman   *accounts.Manager
 
-	ephemeralKeystore string         // if non-empty, the key directory that will be removed by Stop
-	instanceDirLock   flock.Releaser // prevents concurrent use of instance directory
+	ephemeralKeystore string            // if non-empty, the key directory that will be removed by Stop
+	instanceDirLock   fileutil.Releaser // prevents concurrent use of instance directory
 
 	serverConfig p2p.Config
 	server       *p2p.Server // Currently running P2P networking layer
@@ -267,7 +267,7 @@ func (n *Node) openDataDir() error {
 	}
 	// Lock the instance directory to prevent concurrent use by another instance as well as
 	// accidental use of the instance directory as a database.
-	release, _, err := flock.New(filepath.Join(instdir, "LOCK"))
+	release, _, err := fileutil.Flock(filepath.Join(instdir, "LOCK"))
 	if err != nil {
 		return convertFileLockError(err)
 	}
diff --git a/vendor/github.com/prometheus/prometheus/NOTICE b/vendor/github.com/prometheus/prometheus/NOTICE
deleted file mode 100644
index 47de2415e1b6d3c33a26946f03dd99eb6ce1b7c5..0000000000000000000000000000000000000000
--- a/vendor/github.com/prometheus/prometheus/NOTICE
+++ /dev/null
@@ -1,87 +0,0 @@
-The Prometheus systems and service monitoring server
-Copyright 2012-2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
-
-
-The following components are included in this product:
-
-Bootstrap
-http://getbootstrap.com
-Copyright 2011-2014 Twitter, Inc.
-Licensed under the MIT License
-
-bootstrap3-typeahead.js
-https://github.com/bassjobsen/Bootstrap-3-Typeahead
-Original written by @mdo and @fat
-Copyright 2014 Bass Jobsen @bassjobsen
-Licensed under the Apache License, Version 2.0
-
-fuzzy
-https://github.com/mattyork/fuzzy
-Original written by @mattyork
-Copyright 2012 Matt York
-Licensed under the MIT License
-
-bootstrap-datetimepicker.js
-https://github.com/Eonasdan/bootstrap-datetimepicker
-Copyright 2015 Jonathan Peterson (@Eonasdan)
-Licensed under the MIT License
-
-moment.js
-https://github.com/moment/moment/
-Copyright JS Foundation and other contributors
-Licensed under the MIT License
-
-Rickshaw
-https://github.com/shutterstock/rickshaw
-Copyright 2011-2014 by Shutterstock Images, LLC
-See https://github.com/shutterstock/rickshaw/blob/master/LICENSE for license details
-
-mustache.js
-https://github.com/janl/mustache.js
-Copyright 2009 Chris Wanstrath (Ruby)
-Copyright 2010-2014 Jan Lehnardt (JavaScript)
-Copyright 2010-2015 The mustache.js community
-Licensed under the MIT License
-
-jQuery
-https://jquery.org
-Copyright jQuery Foundation and other contributors
-Licensed under the MIT License
-
-Go support for Protocol Buffers - Google's data interchange format
-http://github.com/golang/protobuf/
-Copyright 2010 The Go Authors
-See source code for license details.
-
-Go support for leveled logs, analogous to
-https://code.google.com/p/google-glog/
-Copyright 2013 Google Inc.
-Licensed under the Apache License, Version 2.0
-
-Support for streaming Protocol Buffer messages for the Go language (golang).
-https://github.com/matttproud/golang_protobuf_extensions
-Copyright 2013 Matt T. Proud
-Licensed under the Apache License, Version 2.0
-
-DNS library in Go
-http://miek.nl/posts/2014/Aug/16/go-dns-package/
-Copyright 2009 The Go Authors, 2011 Miek Gieben
-See https://github.com/miekg/dns/blob/master/LICENSE for license details.
-
-LevelDB key/value database in Go
-https://github.com/syndtr/goleveldb
-Copyright 2012 Suryandaru Triandana
-See https://github.com/syndtr/goleveldb/blob/master/LICENSE for license details.
-
-gosnappy - a fork of code.google.com/p/snappy-go
-https://github.com/syndtr/gosnappy
-Copyright 2011 The Snappy-Go Authors
-See https://github.com/syndtr/gosnappy/blob/master/LICENSE for license details.
-
-go-zookeeper - Native ZooKeeper client for Go
-https://github.com/samuel/go-zookeeper
-Copyright (c) 2013, Samuel Stauffer <samuel@descolada.com>
-See https://github.com/samuel/go-zookeeper/blob/master/LICENSE for license details.
diff --git a/vendor/github.com/prometheus/prometheus/LICENSE b/vendor/github.com/prometheus/tsdb/LICENSE
similarity index 100%
rename from vendor/github.com/prometheus/prometheus/LICENSE
rename to vendor/github.com/prometheus/tsdb/LICENSE
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/dir_unix.go b/vendor/github.com/prometheus/tsdb/fileutil/dir_unix.go
new file mode 100644
index 0000000000000000000000000000000000000000..58a77dfc1a99dadb9ab6ba94949a9ca372cc1d5b
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/dir_unix.go
@@ -0,0 +1,22 @@
+// Copyright 2016 The etcd Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build !windows
+
+package fileutil
+
+import "os"
+
+// OpenDir opens a directory for syncing.
+func OpenDir(path string) (*os.File, error) { return os.Open(path) }
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/dir_windows.go b/vendor/github.com/prometheus/tsdb/fileutil/dir_windows.go
new file mode 100644
index 0000000000000000000000000000000000000000..c123395c0040e5c326e852a3feeb90074877cc34
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/dir_windows.go
@@ -0,0 +1,46 @@
+// Copyright 2016 The etcd Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build windows
+
+package fileutil
+
+import (
+	"os"
+	"syscall"
+)
+
+// OpenDir opens a directory in windows with write access for syncing.
+func OpenDir(path string) (*os.File, error) {
+	fd, err := openDir(path)
+	if err != nil {
+		return nil, err
+	}
+	return os.NewFile(uintptr(fd), path), nil
+}
+
+func openDir(path string) (fd syscall.Handle, err error) {
+	if len(path) == 0 {
+		return syscall.InvalidHandle, syscall.ERROR_FILE_NOT_FOUND
+	}
+	pathp, err := syscall.UTF16PtrFromString(path)
+	if err != nil {
+		return syscall.InvalidHandle, err
+	}
+	access := uint32(syscall.GENERIC_READ | syscall.GENERIC_WRITE)
+	sharemode := uint32(syscall.FILE_SHARE_READ | syscall.FILE_SHARE_WRITE)
+	createmode := uint32(syscall.OPEN_EXISTING)
+	fl := uint32(syscall.FILE_FLAG_BACKUP_SEMANTICS)
+	return syscall.CreateFile(pathp, access, sharemode, nil, createmode, fl, 0)
+}
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/fileutil.go b/vendor/github.com/prometheus/tsdb/fileutil/fileutil.go
new file mode 100644
index 0000000000000000000000000000000000000000..154fa184436e603d59b3d0e75b83feac9d68f332
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/fileutil.go
@@ -0,0 +1,149 @@
+// Copyright 2018 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package fileutil provides utility methods used when dealing with the filesystem in tsdb.
+// It is largely copied from github.com/coreos/etcd/pkg/fileutil to avoid the
+// dependency chain it brings with it.
+// Please check github.com/coreos/etcd for licensing information.
+package fileutil
+
+import (
+	"io/ioutil"
+	"os"
+	"path/filepath"
+	"sort"
+	"strings"
+)
+
+// CopyDirs copies all directories, subdirectories and files recursively including the empty folders.
+// Source and destination must be full paths.
+func CopyDirs(src, dest string) error {
+	if err := os.MkdirAll(dest, 0777); err != nil {
+		return err
+	}
+	files, err := readDirs(src)
+	if err != nil {
+		return err
+	}
+
+	for _, f := range files {
+		dp := filepath.Join(dest, f)
+		sp := filepath.Join(src, f)
+
+		stat, err := os.Stat(sp)
+		if err != nil {
+			return err
+		}
+
+		// Empty directories are also created.
+		if stat.IsDir() {
+			if err := os.MkdirAll(dp, 0777); err != nil {
+				return err
+			}
+			continue
+		}
+
+		if err := copyFile(sp, dp); err != nil {
+			return err
+		}
+	}
+	return nil
+}
+
+func copyFile(src, dest string) error {
+	data, err := ioutil.ReadFile(src)
+	if err != nil {
+		return err
+	}
+
+	err = ioutil.WriteFile(dest, data, 0644)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// readDirs reads the source directory recursively and
+// returns relative paths to all files and empty directories.
+func readDirs(src string) ([]string, error) {
+	var files []string
+
+	err := filepath.Walk(src, func(path string, f os.FileInfo, err error) error {
+		relativePath := strings.TrimPrefix(path, src)
+		if len(relativePath) > 0 {
+			files = append(files, relativePath)
+		}
+		return nil
+	})
+	if err != nil {
+		return nil, err
+	}
+	return files, nil
+}
+
+// ReadDir returns the filenames in the given directory in sorted order.
+func ReadDir(dirpath string) ([]string, error) {
+	dir, err := os.Open(dirpath)
+	if err != nil {
+		return nil, err
+	}
+	defer dir.Close()
+	names, err := dir.Readdirnames(-1)
+	if err != nil {
+		return nil, err
+	}
+	sort.Strings(names)
+	return names, nil
+}
+
+// Rename safely renames a file.
+func Rename(from, to string) error {
+	if err := os.Rename(from, to); err != nil {
+		return err
+	}
+
+	// Directory was renamed; sync parent dir to persist rename.
+	pdir, err := OpenDir(filepath.Dir(to))
+	if err != nil {
+		return err
+	}
+
+	if err = Fsync(pdir); err != nil {
+		pdir.Close()
+		return err
+	}
+	return pdir.Close()
+}
+
+// Replace moves a file or directory to a new location and deletes any previous data.
+// It is not atomic.
+func Replace(from, to string) error {
+	if err := os.RemoveAll(to); err != nil {
+		return err
+	}
+	if err := os.Rename(from, to); err != nil {
+		return err
+	}
+
+	// Directory was renamed; sync parent dir to persist rename.
+	pdir, err := OpenDir(filepath.Dir(to))
+	if err != nil {
+		return err
+	}
+
+	if err = Fsync(pdir); err != nil {
+		pdir.Close()
+		return err
+	}
+	return pdir.Close()
+}
diff --git a/vendor/github.com/prometheus/prometheus/util/flock/flock.go b/vendor/github.com/prometheus/tsdb/fileutil/flock.go
similarity index 68%
rename from vendor/github.com/prometheus/prometheus/util/flock/flock.go
rename to vendor/github.com/prometheus/tsdb/fileutil/flock.go
index 5dc22a2fae8f9374dce6b4606ef19d81a51c9f47..d5eaa7ca2adf8d59e8f249e0f59c87ac7e5ab0df 100644
--- a/vendor/github.com/prometheus/prometheus/util/flock/flock.go
+++ b/vendor/github.com/prometheus/tsdb/fileutil/flock.go
@@ -11,12 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// Package flock provides portable file locking. It is essentially ripped out
-// from the code of github.com/syndtr/goleveldb. Strange enough that the
-// standard library does not provide this functionality. Once this package has
-// proven to work as expected, we should probably turn it into a separate
-// general purpose package for humanity.
-package flock
+package fileutil
 
 import (
 	"os"
@@ -28,19 +23,19 @@ type Releaser interface {
 	Release() error
 }
 
-// New locks the file with the provided name. If the file does not exist, it is
+// Flock locks the file with the provided name. If the file does not exist, it is
 // created. The returned Releaser is used to release the lock. existed is true
 // if the file to lock already existed. A non-nil error is returned if the
 // locking has failed. Neither this function nor the returned Releaser is
 // goroutine-safe.
-func New(fileName string) (r Releaser, existed bool, err error) {
+func Flock(fileName string) (r Releaser, existed bool, err error) {
 	if err = os.MkdirAll(filepath.Dir(fileName), 0755); err != nil {
-		return
+		return nil, false, err
 	}
 
 	_, err = os.Stat(fileName)
 	existed = err == nil
 
 	r, err = newLock(fileName)
-	return
+	return r, existed, err
 }
diff --git a/vendor/github.com/prometheus/prometheus/util/flock/flock_plan9.go b/vendor/github.com/prometheus/tsdb/fileutil/flock_plan9.go
similarity index 98%
rename from vendor/github.com/prometheus/prometheus/util/flock/flock_plan9.go
rename to vendor/github.com/prometheus/tsdb/fileutil/flock_plan9.go
index 004e85c0fe4a09ff3c37d41d11b7ab68b86025cf..8a3d44c5e14673a82c2698db40e980c3a8e2c907 100644
--- a/vendor/github.com/prometheus/prometheus/util/flock/flock_plan9.go
+++ b/vendor/github.com/prometheus/tsdb/fileutil/flock_plan9.go
@@ -11,7 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package flock
+package fileutil
 
 import "os"
 
diff --git a/vendor/github.com/prometheus/prometheus/util/flock/flock_solaris.go b/vendor/github.com/prometheus/tsdb/fileutil/flock_solaris.go
similarity index 98%
rename from vendor/github.com/prometheus/prometheus/util/flock/flock_solaris.go
rename to vendor/github.com/prometheus/tsdb/fileutil/flock_solaris.go
index 299fc874465f239eeea76c799ea49edae649076a..7f527ae6c49a285425a439d557f1abbc881c6340 100644
--- a/vendor/github.com/prometheus/prometheus/util/flock/flock_solaris.go
+++ b/vendor/github.com/prometheus/tsdb/fileutil/flock_solaris.go
@@ -13,7 +13,7 @@
 
 // +build solaris
 
-package flock
+package fileutil
 
 import (
 	"os"
diff --git a/vendor/github.com/prometheus/prometheus/util/flock/flock_unix.go b/vendor/github.com/prometheus/tsdb/fileutil/flock_unix.go
similarity index 98%
rename from vendor/github.com/prometheus/prometheus/util/flock/flock_unix.go
rename to vendor/github.com/prometheus/tsdb/fileutil/flock_unix.go
index 7d71f8fc095abf38e312828eecb1bb35f706a83f..f493fbd831daadce2b5d629ea8cb3b14c0a7b754 100644
--- a/vendor/github.com/prometheus/prometheus/util/flock/flock_unix.go
+++ b/vendor/github.com/prometheus/tsdb/fileutil/flock_unix.go
@@ -13,7 +13,7 @@
 
 // +build darwin dragonfly freebsd linux netbsd openbsd
 
-package flock
+package fileutil
 
 import (
 	"os"
diff --git a/vendor/github.com/prometheus/prometheus/util/flock/flock_windows.go b/vendor/github.com/prometheus/tsdb/fileutil/flock_windows.go
similarity index 98%
rename from vendor/github.com/prometheus/prometheus/util/flock/flock_windows.go
rename to vendor/github.com/prometheus/tsdb/fileutil/flock_windows.go
index bf7266f14ca1333de068f58897ce8c571dc89200..1c17ff4ea3035a29190749cf84b788ba0d828918 100644
--- a/vendor/github.com/prometheus/prometheus/util/flock/flock_windows.go
+++ b/vendor/github.com/prometheus/tsdb/fileutil/flock_windows.go
@@ -11,7 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package flock
+package fileutil
 
 import "syscall"
 
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/mmap.go b/vendor/github.com/prometheus/tsdb/fileutil/mmap.go
new file mode 100644
index 0000000000000000000000000000000000000000..26fc80c585036663ade8c6102f1d030bf4edf772
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/mmap.go
@@ -0,0 +1,61 @@
+// Copyright 2018 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package fileutil
+
+import (
+	"os"
+
+	"github.com/pkg/errors"
+)
+
+type MmapFile struct {
+	f *os.File
+	b []byte
+}
+
+func OpenMmapFile(path string) (*MmapFile, error) {
+	f, err := os.Open(path)
+	if err != nil {
+		return nil, errors.Wrap(err, "try lock file")
+	}
+	info, err := f.Stat()
+	if err != nil {
+		return nil, errors.Wrap(err, "stat")
+	}
+
+	b, err := mmap(f, int(info.Size()))
+	if err != nil {
+		return nil, errors.Wrap(err, "mmap")
+	}
+
+	return &MmapFile{f: f, b: b}, nil
+}
+
+func (f *MmapFile) Close() error {
+	err0 := munmap(f.b)
+	err1 := f.f.Close()
+
+	if err0 != nil {
+		return err0
+	}
+	return err1
+}
+
+func (f *MmapFile) File() *os.File {
+	return f.f
+}
+
+func (f *MmapFile) Bytes() []byte {
+	return f.b
+}
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/mmap_386.go b/vendor/github.com/prometheus/tsdb/fileutil/mmap_386.go
new file mode 100644
index 0000000000000000000000000000000000000000..66b9d36803441d25ccb56d504e2cf34197be13f2
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/mmap_386.go
@@ -0,0 +1,18 @@
+// Copyright 2018 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build windows
+
+package fileutil
+
+const maxMapSize = 0x7FFFFFFF // 2GB
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/mmap_amd64.go b/vendor/github.com/prometheus/tsdb/fileutil/mmap_amd64.go
new file mode 100644
index 0000000000000000000000000000000000000000..4b523bc67c2e930e545f039d6b81e80061371cbd
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/mmap_amd64.go
@@ -0,0 +1,18 @@
+// Copyright 2018 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build windows
+
+package fileutil
+
+const maxMapSize = 0xFFFFFFFFFFFF // 256TB
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/mmap_unix.go b/vendor/github.com/prometheus/tsdb/fileutil/mmap_unix.go
new file mode 100644
index 0000000000000000000000000000000000000000..043f4d408cc3abcdd372c728e3932c6c3bc8fc11
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/mmap_unix.go
@@ -0,0 +1,30 @@
+// Copyright 2017 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build !windows,!plan9
+
+package fileutil
+
+import (
+	"os"
+
+	"golang.org/x/sys/unix"
+)
+
+func mmap(f *os.File, length int) ([]byte, error) {
+	return unix.Mmap(int(f.Fd()), 0, length, unix.PROT_READ, unix.MAP_SHARED)
+}
+
+func munmap(b []byte) (err error) {
+	return unix.Munmap(b)
+}
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/mmap_windows.go b/vendor/github.com/prometheus/tsdb/fileutil/mmap_windows.go
new file mode 100644
index 0000000000000000000000000000000000000000..b9422641239f69aaff4e0e6999a3efce5b1e0000
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/mmap_windows.go
@@ -0,0 +1,46 @@
+// Copyright 2017 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package fileutil
+
+import (
+	"os"
+	"syscall"
+	"unsafe"
+)
+
+func mmap(f *os.File, size int) ([]byte, error) {
+	low, high := uint32(size), uint32(size>>32)
+	h, errno := syscall.CreateFileMapping(syscall.Handle(f.Fd()), nil, syscall.PAGE_READONLY, high, low, nil)
+	if h == 0 {
+		return nil, os.NewSyscallError("CreateFileMapping", errno)
+	}
+
+	addr, errno := syscall.MapViewOfFile(h, syscall.FILE_MAP_READ, 0, 0, uintptr(size))
+	if addr == 0 {
+		return nil, os.NewSyscallError("MapViewOfFile", errno)
+	}
+
+	if err := syscall.CloseHandle(syscall.Handle(h)); err != nil {
+		return nil, os.NewSyscallError("CloseHandle", err)
+	}
+
+	return (*[maxMapSize]byte)(unsafe.Pointer(addr))[:size], nil
+}
+
+func munmap(b []byte) error {
+	if err := syscall.UnmapViewOfFile((uintptr)(unsafe.Pointer(&b[0]))); err != nil {
+		return os.NewSyscallError("UnmapViewOfFile", err)
+	}
+	return nil
+}
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/preallocate.go b/vendor/github.com/prometheus/tsdb/fileutil/preallocate.go
new file mode 100644
index 0000000000000000000000000000000000000000..c747b7cf81f93ecad8d670c03babbcc62f5886ed
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/preallocate.go
@@ -0,0 +1,54 @@
+// Copyright 2015 The etcd Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package fileutil
+
+import (
+	"io"
+	"os"
+)
+
+// Preallocate tries to allocate the space for given
+// file. This operation is only supported on linux by a
+// few filesystems (btrfs, ext4, etc.).
+// If the operation is unsupported, no error will be returned.
+// Otherwise, the error encountered will be returned.
+func Preallocate(f *os.File, sizeInBytes int64, extendFile bool) error {
+	if sizeInBytes == 0 {
+		// fallocate will return EINVAL if length is 0; skip
+		return nil
+	}
+	if extendFile {
+		return preallocExtend(f, sizeInBytes)
+	}
+	return preallocFixed(f, sizeInBytes)
+}
+
+func preallocExtendTrunc(f *os.File, sizeInBytes int64) error {
+	curOff, err := f.Seek(0, io.SeekCurrent)
+	if err != nil {
+		return err
+	}
+	size, err := f.Seek(sizeInBytes, io.SeekEnd)
+	if err != nil {
+		return err
+	}
+	if _, err = f.Seek(curOff, io.SeekStart); err != nil {
+		return err
+	}
+	if sizeInBytes > size {
+		return nil
+	}
+	return f.Truncate(sizeInBytes)
+}
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/preallocate_darwin.go b/vendor/github.com/prometheus/tsdb/fileutil/preallocate_darwin.go
new file mode 100644
index 0000000000000000000000000000000000000000..c9fa1a6c226082bd3dcae429df90ed4dd43c62b7
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/preallocate_darwin.go
@@ -0,0 +1,41 @@
+// Copyright 2015 The etcd Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package fileutil
+
+import (
+	"os"
+	"syscall"
+	"unsafe"
+)
+
+func preallocExtend(f *os.File, sizeInBytes int64) error {
+	if err := preallocFixed(f, sizeInBytes); err != nil {
+		return err
+	}
+	return preallocExtendTrunc(f, sizeInBytes)
+}
+
+func preallocFixed(f *os.File, sizeInBytes int64) error {
+	fstore := &syscall.Fstore_t{
+		Flags:   syscall.F_ALLOCATEALL,
+		Posmode: syscall.F_PEOFPOSMODE,
+		Length:  sizeInBytes}
+	p := unsafe.Pointer(fstore)
+	_, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.Fd(), uintptr(syscall.F_PREALLOCATE), uintptr(p))
+	if errno == 0 || errno == syscall.ENOTSUP {
+		return nil
+	}
+	return errno
+}
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/preallocate_linux.go b/vendor/github.com/prometheus/tsdb/fileutil/preallocate_linux.go
new file mode 100644
index 0000000000000000000000000000000000000000..ada0462213e3f2e3cd726f70b9414ea3bfd2f3f1
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/preallocate_linux.go
@@ -0,0 +1,47 @@
+// Copyright 2015 The etcd Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package fileutil
+
+import (
+	"os"
+	"syscall"
+)
+
+func preallocExtend(f *os.File, sizeInBytes int64) error {
+	// use mode = 0 to change size
+	err := syscall.Fallocate(int(f.Fd()), 0, 0, sizeInBytes)
+	if err != nil {
+		errno, ok := err.(syscall.Errno)
+		// not supported; fallback
+		// fallocate EINTRs frequently in some environments; fallback
+		if ok && (errno == syscall.ENOTSUP || errno == syscall.EINTR) {
+			return preallocExtendTrunc(f, sizeInBytes)
+		}
+	}
+	return err
+}
+
+func preallocFixed(f *os.File, sizeInBytes int64) error {
+	// use mode = 1 to keep size; see FALLOC_FL_KEEP_SIZE
+	err := syscall.Fallocate(int(f.Fd()), 1, 0, sizeInBytes)
+	if err != nil {
+		errno, ok := err.(syscall.Errno)
+		// treat not supported as nil error
+		if ok && errno == syscall.ENOTSUP {
+			return nil
+		}
+	}
+	return err
+}
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/preallocate_other.go b/vendor/github.com/prometheus/tsdb/fileutil/preallocate_other.go
new file mode 100644
index 0000000000000000000000000000000000000000..162fbc5f7826c72e792306d0b0def0752b9a6bae
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/preallocate_other.go
@@ -0,0 +1,25 @@
+// Copyright 2015 The etcd Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build !linux,!darwin
+
+package fileutil
+
+import "os"
+
+func preallocExtend(f *os.File, sizeInBytes int64) error {
+	return preallocExtendTrunc(f, sizeInBytes)
+}
+
+func preallocFixed(f *os.File, sizeInBytes int64) error { return nil }
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/sync.go b/vendor/github.com/prometheus/tsdb/fileutil/sync.go
new file mode 100644
index 0000000000000000000000000000000000000000..54dd41f4f35171979e2068ebcc99813703ed2aab
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/sync.go
@@ -0,0 +1,29 @@
+// Copyright 2016 The etcd Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build !linux,!darwin
+
+package fileutil
+
+import "os"
+
+// Fsync is a wrapper around file.Sync(). Special handling is needed on darwin platform.
+func Fsync(f *os.File) error {
+	return f.Sync()
+}
+
+// Fdatasync is a wrapper around file.Sync(). Special handling is needed on linux platform.
+func Fdatasync(f *os.File) error {
+	return f.Sync()
+}
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/sync_darwin.go b/vendor/github.com/prometheus/tsdb/fileutil/sync_darwin.go
new file mode 100644
index 0000000000000000000000000000000000000000..c2f39bf204d239ada2c1a5a90654e89b80af6b37
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/sync_darwin.go
@@ -0,0 +1,40 @@
+// Copyright 2016 The etcd Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build darwin
+
+package fileutil
+
+import (
+	"os"
+	"syscall"
+)
+
+// Fsync on HFS/OSX flushes the data on to the physical drive but the drive
+// may not write it to the persistent media for quite sometime and it may be
+// written in out-of-order sequence. Using F_FULLFSYNC ensures that the
+// physical drive's buffer will also get flushed to the media.
+func Fsync(f *os.File) error {
+	_, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.Fd(), uintptr(syscall.F_FULLFSYNC), uintptr(0))
+	if errno == 0 {
+		return nil
+	}
+	return errno
+}
+
+// Fdatasync on darwin platform invokes fcntl(F_FULLFSYNC) for actual persistence
+// on physical drive media.
+func Fdatasync(f *os.File) error {
+	return Fsync(f)
+}
diff --git a/vendor/github.com/prometheus/tsdb/fileutil/sync_linux.go b/vendor/github.com/prometheus/tsdb/fileutil/sync_linux.go
new file mode 100644
index 0000000000000000000000000000000000000000..1bbced915e9bf2c195f8e4075bb93dedb4bde2e1
--- /dev/null
+++ b/vendor/github.com/prometheus/tsdb/fileutil/sync_linux.go
@@ -0,0 +1,34 @@
+// Copyright 2016 The etcd Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build linux
+
+package fileutil
+
+import (
+	"os"
+	"syscall"
+)
+
+// Fsync is a wrapper around file.Sync(). Special handling is needed on darwin platform.
+func Fsync(f *os.File) error {
+	return f.Sync()
+}
+
+// Fdatasync is similar to fsync(), but does not flush modified metadata
+// unless that metadata is needed in order to allow a subsequent data retrieval
+// to be correctly handled.
+func Fdatasync(f *os.File) error {
+	return syscall.Fdatasync(int(f.Fd()))
+}
diff --git a/vendor/vendor.json b/vendor/vendor.json
index e965b4d7f06c868db04a33687df66686636d18cf..e6b0d8b4abdedbb49442de9ab86b3f6f31e85e81 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -400,10 +400,10 @@
 			"revisionTime": "2016-01-10T10:55:54Z"
 		},
 		{
-			"checksumSHA1": "WbbxCn2jUYIL5viqLo0BKXEdPrQ=",
-			"path": "github.com/prometheus/prometheus/util/flock",
-			"revision": "3101606756c53221ed58ba94ecba6b26adf89dcc",
-			"revisionTime": "2017-08-14T17:01:13Z"
+			"checksumSHA1": "hOxzP9VnSzMLzqDtuW5Bhjn2DWU=",
+			"path": "github.com/prometheus/tsdb/fileutil",
+			"revision": "4f204dcbc15056cdd047b06ac6111becda5c2915",
+			"revisionTime": "2019-04-02T12:16:29Z"
 		},
 		{
 			"checksumSHA1": "lU41NL1TEDtsrr0yUdp3SMB4Y9o=",