From 906e600521ebd7f907a4b2e7181060bf6e7537d4 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Tue, 8 Oct 2019 00:43:39 +0100 Subject: [PATCH] Update rixxdb --- cli/start.go | 2 +- cnf/cnf.go | 2 +- go.mod | 2 +- go.sum | 2 ++ kvs/rixxdb/main.go | 6 ++++-- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cli/start.go b/cli/start.go index 4b450076..b2e6d1f7 100644 --- a/cli/start.go +++ b/cli/start.go @@ -75,7 +75,7 @@ func init() { startCmd.PersistentFlags().StringVarP(&opts.DB.Code, "key", "k", "", "Encryption key to use for on-disk encryption") - startCmd.PersistentFlags().DurationVar(&opts.DB.Proc.Sync, "db-sync", 0, "A time duration to use when syncing data to persistent storage") + startCmd.PersistentFlags().DurationVar(&opts.DB.Proc.Flush, "db-flush", 0, "A time duration to use when syncing data to persistent storage") startCmd.PersistentFlags().DurationVar(&opts.DB.Proc.Shrink, "db-shrink", 0, "A time duration to use when shrinking data on persistent storage") startCmd.PersistentFlags().StringVar(&opts.DB.Cert.CA, "kvs-ca", "", "Path to the CA file used to connect to the remote database") diff --git a/cnf/cnf.go b/cnf/cnf.go index 35da2631..0087caac 100644 --- a/cnf/cnf.go +++ b/cnf/cnf.go @@ -29,7 +29,7 @@ type Options struct { Path string // Path to store the data file Base string // Base key to use in KV stores Proc struct { - Sync time.Duration // Timeframe for syncing data + Flush time.Duration // Timeframe for flushing data Shrink time.Duration // Timeframe for shrinking data } Cert struct { diff --git a/go.mod b/go.mod index ce79c09e..06db3efb 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/abcum/bump v0.0.0-20190929092354-46a9c9dbf9ab github.com/abcum/cork v0.0.0-20190929093632-f45e788b8f1b github.com/abcum/fibre v0.0.0-20191003170635-45f18bd55f9a - github.com/abcum/rixxdb v0.0.0-20191003170549-44f889db956a + github.com/abcum/rixxdb v0.0.0-20191007234208-a644cc21c6bd github.com/abcum/tmpl v0.0.0-20190929092451-4b08f6027ed1 // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/elithrar/simple-scrypt v1.3.0 diff --git a/go.sum b/go.sum index a6422c63..4ee87f66 100644 --- a/go.sum +++ b/go.sum @@ -7,6 +7,8 @@ github.com/abcum/fibre v0.0.0-20191003170635-45f18bd55f9a h1:w7vwArRjHlY/Kvi4f86 github.com/abcum/fibre v0.0.0-20191003170635-45f18bd55f9a/go.mod h1:CPo8U5dmWBEajd6U7ozAQRp0b1zbuRkaAyZJneBZ63g= github.com/abcum/rixxdb v0.0.0-20191003170549-44f889db956a h1:J/GpT8OmcVuKW+SBYMRx+pZrjaFIUQlBRTx7I07bk84= github.com/abcum/rixxdb v0.0.0-20191003170549-44f889db956a/go.mod h1:6lIALuvT453ADA/5AFRXGLDNcc3sqIvt4ISaKyPeTLg= +github.com/abcum/rixxdb v0.0.0-20191007234208-a644cc21c6bd h1:H3T4nMRicB2kVgkmgXbvqAecczHm5397FpYgm24/c8o= +github.com/abcum/rixxdb v0.0.0-20191007234208-a644cc21c6bd/go.mod h1:6lIALuvT453ADA/5AFRXGLDNcc3sqIvt4ISaKyPeTLg= github.com/abcum/tmpl v0.0.0-20190929092451-4b08f6027ed1 h1:hRp2bOK7p4HTCCFl4v0apR309NuN1qpKnWnX21JSCHQ= github.com/abcum/tmpl v0.0.0-20190929092451-4b08f6027ed1/go.mod h1:T/xXRVJ6YMMHqf+MiKW6KELsEmb2n4eNMsaNQ6lI5M8= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= diff --git a/kvs/rixxdb/main.go b/kvs/rixxdb/main.go index ed9c7161..58fffc27 100644 --- a/kvs/rixxdb/main.go +++ b/kvs/rixxdb/main.go @@ -28,14 +28,16 @@ func init() { var pntr *rixxdb.DB pntr, err = rixxdb.Open(opts.DB.Path, &rixxdb.Config{ + // Explicitly sync writes + SyncWrites: true, // Set the encryption key EncryptionKey: opts.DB.Key, // Set the sync offset duration - SyncPolicy: opts.DB.Proc.Sync, + FlushPolicy: opts.DB.Proc.Flush, // Set the shrink offset duration ShrinkPolicy: opts.DB.Proc.Shrink, // Don't wait for syncing if shrinking - IgnoreSyncPolicyWhenShrinking: true, + IgnorePolicyWhenShrinking: true, }) if err != nil {