@@ -108,12 +108,8 @@ func init() {
108
108
// reading (in some tests).
109
109
DefaultOptions .Options .ValueLogLoadingMode = options .FileIO
110
110
111
- if os .Getenv ("GOARCH" ) == "386" {
112
- DefaultOptions .Options .TableLoadingMode = options .FileIO
113
- } else {
114
- // Explicitly set this to mmap. This doesn't use much memory anyways.
115
- DefaultOptions .Options .TableLoadingMode = options .MemoryMap
116
- }
111
+ // Explicitly set this to mmap. This doesn't use much memory anyways.
112
+ DefaultOptions .Options .TableLoadingMode = options .MemoryMap
117
113
118
114
// Reduce this from 64MiB to 16MiB. That means badger will hold on to
119
115
// 20MiB by default instead of 80MiB.
@@ -133,22 +129,26 @@ var _ ds.Batching = (*Datastore)(nil)
133
129
// NewDatastore creates a new badger datastore.
134
130
//
135
131
// DO NOT set the Dir and/or ValuePath fields of opt, they will be set for you.
136
- func NewDatastore (path string , options * Options ) (* Datastore , error ) {
132
+ func NewDatastore (path string , opts * Options ) (* Datastore , error ) {
137
133
// Copy the options because we modify them.
138
134
var opt badger.Options
139
135
var gcDiscardRatio float64
140
136
var gcSleep time.Duration
141
137
var gcInterval time.Duration
142
- if options == nil {
138
+ if opts == nil {
143
139
opt = badger .DefaultOptions ("" )
144
140
gcDiscardRatio = DefaultOptions .GcDiscardRatio
145
141
gcSleep = DefaultOptions .GcSleep
146
142
gcInterval = DefaultOptions .GcInterval
147
143
} else {
148
- opt = options .Options
149
- gcDiscardRatio = options .GcDiscardRatio
150
- gcSleep = options .GcSleep
151
- 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
152
152
}
153
153
154
154
if gcSleep <= 0 {
0 commit comments