Commit 85674d8a authored by yxq's avatar yxq

ref docs

parent 41606403
// chain33/common/db/mvcc.go L:427
```Go
// chain33/common/db/mvcc.go L:427 // chain33/common/db/mvcc.go L:427
func pad(version int64) []byte { func pad(version int64) []byte {
s := fmt.Sprintf("%020d", version) s := fmt.Sprintf("%020d", version)
...@@ -26,6 +28,9 @@ func pad3(version int64, padLen int) []byte { ...@@ -26,6 +28,9 @@ func pad3(version int64, padLen int) []byte {
return result return result
} }
```
```Go
// chain33/common/db/mvcc.go L:432 // chain33/common/db/mvcc.go L:432
func GetKeyPerfix(key []byte) []byte { func GetKeyPerfix(key []byte) []byte {
b := append([]byte{}, mvccData...) b := append([]byte{}, mvccData...)
...@@ -43,6 +48,9 @@ func GetKeyPerfix2(key []byte) []byte { ...@@ -43,6 +48,9 @@ func GetKeyPerfix2(key []byte) []byte {
return newKey return newKey
} }
```
```Go
// chain33/util/exec.go L:226 // chain33/util/exec.go L:226
func DelDupKey(kvs []*types.KeyValue) []*types.KeyValue { func DelDupKey(kvs []*types.KeyValue) []*types.KeyValue {
dupindex := make(map[string]int) dupindex := make(map[string]int)
...@@ -85,3 +93,4 @@ BenchmarkDelDupKey2 171 7748627 ns/op 2254615 B/ ...@@ -85,3 +93,4 @@ BenchmarkDelDupKey2 171 7748627 ns/op 2254615 B/
由于[]byte不可比较因此不能作为map的key,通常把[]byte转换成string后作为map的key。如果在map的方括号内进行类型转换,Go编译器会进行优化,复用相同的string,避免重复申请内存 由于[]byte不可比较因此不能作为map的key,通常把[]byte转换成string后作为map的key。如果在map的方括号内进行类型转换,Go编译器会进行优化,复用相同的string,避免重复申请内存
*/ */
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment