MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / newOptions

Function newOptions

driver/ipfs/db.go:133–158  ·  view source on GitHub ↗
(cfg *config.LevelDBConfig)

Source from the content-addressed store, hash-verified

131}
132
133func newOptions(cfg *config.LevelDBConfig) *opt.Options {
134 opts := &opt.Options{}
135 opts.ErrorIfMissing = false
136
137 opts.BlockCacheCapacity = cfg.CacheSize
138
139 // we must use bloomfilter
140 opts.Filter = filter.NewBloomFilter(defaultFilterBits)
141
142 if !cfg.Compression {
143 opts.Compression = opt.NoCompression
144 } else {
145 opts.Compression = opt.SnappyCompression
146 }
147
148 opts.BlockSize = cfg.BlockSize
149 opts.WriteBuffer = cfg.WriteBufferSize
150 opts.OpenFilesCacheCapacity = cfg.MaxOpenFiles
151
152 // here we use default value, later add config support
153 opts.CompactionTableSize = 32 * 1024 * 1024
154 opts.WriteL0SlowdownTrigger = 16
155 opts.WriteL0PauseTrigger = 64
156
157 return opts
158}
159
160func (db *DB) Close() error {
161 db.cache.Close()

Callers 2

RepairMethod · 0.70
initOptsMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected