From e5aaa976ba0fde08de7bc7824cf057add525d2b8 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Fri, 8 May 2015 13:11:15 -0600 Subject: [PATCH] Add DB.Sync(). This commit adds DB.Sync() for users who set DB.NoSync to true. --- db.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/db.go b/db.go index b2c44fb..b78640f 100644 --- a/db.go +++ b/db.go @@ -556,6 +556,12 @@ func (db *DB) View(fn func(*Tx) error) error { return nil } +// Sync executes fdatasync() against the database file handle. +// +// This is not necessary under normal operation, however, if you use NoSync +// then it allows you to force the database file to sync against the disk. +func (db *DB) Sync() error { return fdatasync(db) } + // Stats retrieves ongoing performance stats for the database. // This is only updated when a transaction closes. func (db *DB) Stats() Stats {