Skip to content

Commit 049706b

Browse files
authored
Merge pull request #127 from ipfs/update-dependencies
Update dependencies and minimum go version
2 parents 72b000d + 8afd4ff commit 049706b

File tree

4 files changed

+146
-154
lines changed

4 files changed

+146
-154
lines changed

datastore.go

+11-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"os"
78
"runtime"
89
"strings"
910
"sync"
@@ -128,22 +129,26 @@ var _ ds.Batching = (*Datastore)(nil)
128129
// NewDatastore creates a new badger datastore.
129130
//
130131
// DO NOT set the Dir and/or ValuePath fields of opt, they will be set for you.
131-
func NewDatastore(path string, options *Options) (*Datastore, error) {
132+
func NewDatastore(path string, opts *Options) (*Datastore, error) {
132133
// Copy the options because we modify them.
133134
var opt badger.Options
134135
var gcDiscardRatio float64
135136
var gcSleep time.Duration
136137
var gcInterval time.Duration
137-
if options == nil {
138+
if opts == nil {
138139
opt = badger.DefaultOptions("")
139140
gcDiscardRatio = DefaultOptions.GcDiscardRatio
140141
gcSleep = DefaultOptions.GcSleep
141142
gcInterval = DefaultOptions.GcInterval
142143
} else {
143-
opt = options.Options
144-
gcDiscardRatio = options.GcDiscardRatio
145-
gcSleep = options.GcSleep
146-
gcInterval = options.GcInterval
144+
opt = opts.Options
145+
gcDiscardRatio = opts.GcDiscardRatio
146+
gcSleep = opts.GcSleep
147+
gcInterval = opts.GcInterval
148+
}
149+
150+
if os.Getenv("GOARCH") == "386" {
151+
opt.TableLoadingMode = options.FileIO
147152
}
148153

149154
if gcSleep <= 0 {

0 commit comments

Comments
 (0)