Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
cab82e0a
Commit
cab82e0a
authored
Feb 20, 2019
by
liuyuhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify file name
parent
1cede8d1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
15 deletions
+15
-15
chain33.toml
chain33.toml
+1
-1
init.go
plugin/store/init/init.go
+1
-1
kvmvcc_mavl.go
plugin/store/kvmvccmavl/kvmvcc_mavl.go
+13
-13
kvmvcc_mavl_test.go
plugin/store/kvmvccmavl/kvmvcc_mavl_test.go
+0
-0
kvmvccdb.go
plugin/store/kvmvccmavl/kvmvccdb.go
+0
-0
mavl.go
plugin/store/kvmvccmavl/mavl.go
+0
-0
No files found.
chain33.toml
View file @
cab82e0a
...
...
@@ -147,7 +147,7 @@ enableMVCC=false
enableMavlPrune
=
false
pruneHeight
=
10000
[store.sub.kvmvcc
M
avl]
[store.sub.kvmvcc
m
avl]
enableMVCCIter
=
false
enableMavlPrefix
=
false
enableMVCC
=
false
...
...
plugin/store/init/init.go
View file @
cab82e0a
...
...
@@ -3,6 +3,6 @@ package init
import
(
_
"github.com/33cn/plugin/plugin/store/kvdb"
//auto gen
_
"github.com/33cn/plugin/plugin/store/kvmvcc"
//auto gen
_
"github.com/33cn/plugin/plugin/store/kvmvcc
M
avl"
//auto gen
_
"github.com/33cn/plugin/plugin/store/kvmvcc
m
avl"
//auto gen
_
"github.com/33cn/plugin/plugin/store/mpt"
//auto gen
)
plugin/store/kvmvcc
Mavl/kvmvccM
avl.go
→
plugin/store/kvmvcc
mavl/kvmvcc_m
avl.go
View file @
cab82e0a
...
...
@@ -34,7 +34,7 @@ var (
)
const
(
ca
nc
eSize
=
2048
//可以缓存2048个roothash, height对
ca
ch
eSize
=
2048
//可以缓存2048个roothash, height对
batchDataSize
=
1024
*
1024
*
1
delMavlStateStart
=
1
delMavlStateEnd
=
0
...
...
@@ -52,7 +52,7 @@ func DisableLog() {
}
func
init
()
{
drivers
.
Reg
(
"kvmvcc
M
avl"
,
New
)
drivers
.
Reg
(
"kvmvcc
m
avl"
,
New
)
}
// KVmMavlStore provide kvmvcc and mavl store interface implementation
...
...
@@ -60,7 +60,7 @@ type KVmMavlStore struct {
*
drivers
.
BaseStore
*
KVMVCCStore
*
MavlStore
ca
nc
e
*
lru
.
Cache
ca
ch
e
*
lru
.
Cache
}
type
subKVMVCCConfig
struct
{
...
...
@@ -97,7 +97,7 @@ func New(cfg *types.Store, sub []byte) queue.Module {
subMavlcfg
.
EnableMavlPrune
=
subcfg
.
EnableMavlPrune
subMavlcfg
.
PruneHeight
=
subcfg
.
PruneHeight
}
cance
,
err
:=
lru
.
New
(
ca
nc
eSize
)
cance
,
err
:=
lru
.
New
(
ca
ch
eSize
)
if
err
!=
nil
{
panic
(
"new KVmMavlStore fail"
)
}
...
...
@@ -135,14 +135,14 @@ func (kvmMavls *KVmMavlStore) Set(datas *types.StoreSet, sync bool) ([]byte, err
return
hash
,
err
}
if
err
==
nil
{
kvmMavls
.
ca
nc
e
.
Add
(
string
(
hash
),
datas
.
Height
)
kvmMavls
.
ca
ch
e
.
Add
(
string
(
hash
),
datas
.
Height
)
}
return
hash
,
err
}
// 仅仅做kvmvcc
hash
,
err
:=
kvmMavls
.
KVMVCCStore
.
Set
(
datas
,
nil
,
sync
)
if
err
==
nil
{
kvmMavls
.
ca
nc
e
.
Add
(
string
(
hash
),
datas
.
Height
)
kvmMavls
.
ca
ch
e
.
Add
(
string
(
hash
),
datas
.
Height
)
}
// 删除Mavl数据
if
datas
.
Height
>
delMavlDataHeight
&&
!
isDelMavlData
&&
!
isDelMavling
()
{
...
...
@@ -169,14 +169,14 @@ func (kvmMavls *KVmMavlStore) MemSet(datas *types.StoreSet, sync bool) ([]byte,
return
hash
,
err
}
if
err
==
nil
{
kvmMavls
.
ca
nc
e
.
Add
(
string
(
hash
),
datas
.
Height
)
kvmMavls
.
ca
ch
e
.
Add
(
string
(
hash
),
datas
.
Height
)
}
return
hash
,
err
}
// 仅仅做kvmvcc
hash
,
err
:=
kvmMavls
.
KVMVCCStore
.
MemSet
(
datas
,
nil
,
sync
)
if
err
==
nil
{
kvmMavls
.
ca
nc
e
.
Add
(
string
(
hash
),
datas
.
Height
)
kvmMavls
.
ca
ch
e
.
Add
(
string
(
hash
),
datas
.
Height
)
}
// 删除Mavl数据
if
datas
.
Height
>
delMavlDataHeight
&&
!
isDelMavlData
&&
!
isDelMavling
()
{
...
...
@@ -188,7 +188,7 @@ func (kvmMavls *KVmMavlStore) MemSet(datas *types.StoreSet, sync bool) ([]byte,
// Commit kvs in the mem of KVmMavlStore module to state db and return the StateHash
func
(
kvmMavls
*
KVmMavlStore
)
Commit
(
req
*
types
.
ReqHash
)
([]
byte
,
error
)
{
if
value
,
ok
:=
kvmMavls
.
ca
nc
e
.
Get
(
string
(
req
.
Hash
));
ok
{
if
value
,
ok
:=
kvmMavls
.
ca
ch
e
.
Get
(
string
(
req
.
Hash
));
ok
{
if
value
.
(
int64
)
<
kvmvccMavlFork
{
hash
,
err
:=
kvmMavls
.
MavlStore
.
Commit
(
req
)
if
err
!=
nil
{
...
...
@@ -204,7 +204,7 @@ func (kvmMavls *KVmMavlStore) Commit(req *types.ReqHash) ([]byte, error) {
// Rollback kvs in the mem of KVmMavlStore module and return the StateHash
func
(
kvmMavls
*
KVmMavlStore
)
Rollback
(
req
*
types
.
ReqHash
)
([]
byte
,
error
)
{
if
value
,
ok
:=
kvmMavls
.
ca
nc
e
.
Get
(
string
(
req
.
Hash
));
ok
{
if
value
,
ok
:=
kvmMavls
.
ca
ch
e
.
Get
(
string
(
req
.
Hash
));
ok
{
if
value
.
(
int64
)
<
kvmvccMavlFork
{
hash
,
err
:=
kvmMavls
.
MavlStore
.
Rollback
(
req
)
if
err
!=
nil
{
...
...
@@ -220,7 +220,7 @@ func (kvmMavls *KVmMavlStore) Rollback(req *types.ReqHash) ([]byte, error) {
// IterateRangeByStateHash travel with Prefix by StateHash to get the latest version kvs.
func
(
kvmMavls
*
KVmMavlStore
)
IterateRangeByStateHash
(
statehash
[]
byte
,
start
[]
byte
,
end
[]
byte
,
ascending
bool
,
fn
func
(
key
,
value
[]
byte
)
bool
)
{
if
value
,
ok
:=
kvmMavls
.
ca
nc
e
.
Get
(
string
(
statehash
));
ok
{
if
value
,
ok
:=
kvmMavls
.
ca
ch
e
.
Get
(
string
(
statehash
));
ok
{
if
value
.
(
int64
)
<
kvmvccMavlFork
{
kvmMavls
.
MavlStore
.
IterateRangeByStateHash
(
statehash
,
start
,
end
,
ascending
,
fn
)
return
...
...
@@ -248,14 +248,14 @@ func (kvmMavls *KVmMavlStore) Del(req *types.StoreDel) ([]byte, error) {
return
hash
,
err
}
if
err
==
nil
{
kvmMavls
.
ca
nc
e
.
Remove
(
string
(
req
.
StateHash
))
kvmMavls
.
ca
ch
e
.
Remove
(
string
(
req
.
StateHash
))
}
return
hash
,
err
}
// 仅仅做kvmvcc
hash
,
err
:=
kvmMavls
.
KVMVCCStore
.
Del
(
req
)
if
err
==
nil
{
kvmMavls
.
ca
nc
e
.
Remove
(
string
(
req
.
StateHash
))
kvmMavls
.
ca
ch
e
.
Remove
(
string
(
req
.
StateHash
))
}
return
hash
,
err
}
...
...
plugin/store/kvmvcc
Mavl/kvmvccM
avl_test.go
→
plugin/store/kvmvcc
mavl/kvmvcc_m
avl_test.go
View file @
cab82e0a
File moved
plugin/store/kvmvcc
M
avl/kvmvccdb.go
→
plugin/store/kvmvcc
m
avl/kvmvccdb.go
View file @
cab82e0a
File moved
plugin/store/kvmvcc
M
avl/mavl.go
→
plugin/store/kvmvcc
m
avl/mavl.go
View file @
cab82e0a
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment