How I play with bolt database

blov · · 2158 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I have been playing with bolt database, and I wrote a helper for interacting with the bolt dabase. This was after I find it very difficult working with nested buckets.</p> <p>You can view the project here <a href="https://github.com/gernest/nutz" rel="nofollow">https://github.com/gernest/nutz</a> Please feedback will be highly appreciated, thanks!</p> <hr/>**评论:**<br/><br/>virtuallynathan: <pre><p>You may want to read <a href="https://golang.org/doc/effective_go.html">https://golang.org/doc/effective_go.html</a></p> <p>And run your code through go fmt, go vet, go lint, etc... </p> <p>at line 16, character 6, file nutz.goexported type Storage should have comment or be unexported</p> <p>at line 29, character 1, file nutz.goexported function NewStorage should have comment or be unexported</p> <p>at line 37, character 1, file nutz.goexported method Storage.CreateDataRecord should have comment or be unexported</p> <p>at line 94, character 1, file nutz.goexported method Storage.GetDataRecord should have comment or be unexported</p> <p>at line 99, character 19, file nutz.goshould drop = nil from declaration of var uerr; it is the zero value</p> <p>at line 154, character 1, file nutz.goexported method Storage.UpdateDataRecord should have comment or be unexported</p> <p>at line 209, character 1, file nutz.goexported method Storage.GetAll should have comment or be unexported</p> <p>at line 214, character 19, file nutz.goshould drop = nil from declaration of var uerr; it is the zero value</p> <p>at line 270, character 1, file nutz.goexported method Storage.RemoveDataRecord should have comment or be unexported</p> <p>at line 275, character 19, file nutz.goshould drop = nil from declaration of var uerr; it is the zero value</p> <p>at line 318, character 1, file nutz.goexported method Storage.DeleteDatabase should have comment or be unexported</p> <p>at line 331, character 9, file nutz.goshould replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...)</p></pre>gernest_: <pre><p>thanks, I will work on that!</p></pre>gernest_: <pre><p>Fixed now all the tools are are tested on the code ie vet, lint, test and goimports.</p> <p>Thants again for the feedback.</p></pre>Twirrim: <pre><p>Just curious, has anyone seen BoltDB run through Aphyr&#39;s Jepsen test suite? One of the defining feature for me of most of these new generation of databases is their shocking behaviour in the face of network partitioning (no matter what people tell you, they do happen, and usually at the worst time possible), and other unexpected events.</p></pre>tv64738: <pre><p>You seem to be confusing Bolt for a distributed system. It isn&#39;t.</p></pre>Twirrim: <pre><p>Heh, guess so. Too many databases, not enough brain to keep them all in mind. Why are they reinventing the wheel here though? Why not just use LMDB or other proven, reliable, fast and safe libraries?</p></pre>captncraig: <pre><p>They discuss this in the readme: </p> <p>Bolt was originally a port of LMDB so it is architecturally similar. Both use a B+tree, have ACID semantics with fully serializable transactions, and support lock-free MVCC using a single writer and multiple readers.</p> <p>The two projects have somewhat diverged. LMDB heavily focuses on raw performance while Bolt has focused on simplicity and ease of use. For example, LMDB allows several unsafe actions such as direct writes for the sake of performance. Bolt opts to disallow actions which can leave the database in a corrupted state. The only exception to this in Bolt is DB.NoSync.</p> <p>There are also a few differences in API. LMDB requires a maximum mmap size when opening an mdb_env whereas Bolt will handle incremental mmap resizing automatically. LMDB overloads the getter and setter functions with multiple flags whereas Bolt splits these specialized cases into their own functions.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

2158 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传