aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/sqlvm/runtime
diff options
context:
space:
mode:
authoryenlin.lai <yenlin.lai@cobinhood.com>2019-04-08 17:08:47 +0800
committerJhih-Ming Huang <jm.huang@cobinhood.com>2019-05-06 10:44:04 +0800
commitb99b6272d7c0858f66867cc1ac056686bbf33fe0 (patch)
treeab2b00f124a4abdea1b5d9b0da3f1ef59ad63579 /core/vm/sqlvm/runtime
parent9b8e66235752d5334a10023f9e00218904d746e8 (diff)
downloaddexon-b99b6272d7c0858f66867cc1ac056686bbf33fe0.tar
dexon-b99b6272d7c0858f66867cc1ac056686bbf33fe0.tar.gz
dexon-b99b6272d7c0858f66867cc1ac056686bbf33fe0.tar.bz2
dexon-b99b6272d7c0858f66867cc1ac056686bbf33fe0.tar.lz
dexon-b99b6272d7c0858f66867cc1ac056686bbf33fe0.tar.xz
dexon-b99b6272d7c0858f66867cc1ac056686bbf33fe0.tar.zst
dexon-b99b6272d7c0858f66867cc1ac056686bbf33fe0.zip
sqlvm: common: add some shared methods on Storage struct
Add methods for ACL control and index meta loading. These methods will be used outside runtime, so put them on Storage.
Diffstat (limited to 'core/vm/sqlvm/runtime')
-rw-r--r--core/vm/sqlvm/runtime/instructions.go2
-rw-r--r--core/vm/sqlvm/runtime/instructions_test.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/core/vm/sqlvm/runtime/instructions.go b/core/vm/sqlvm/runtime/instructions.go
index b6b37052e..92d5753f5 100644
--- a/core/vm/sqlvm/runtime/instructions.go
+++ b/core/vm/sqlvm/runtime/instructions.go
@@ -127,7 +127,7 @@ func opLoad(ctx *common.Context, input []*Operand, registers []*Operand, output
}
for i, id := range ids {
slotDataCache := make(map[dexCommon.Hash]dexCommon.Hash)
- head := ctx.Storage.GetPrimaryKeyHash(table.Name, id)
+ head := ctx.Storage.GetRowPathHash(table.Name, id)
for j := range fields {
col := table.Columns[int(fields[j])]
byteOffset := col.ByteOffset
diff --git a/core/vm/sqlvm/runtime/instructions_test.go b/core/vm/sqlvm/runtime/instructions_test.go
index 576a7783a..fe9f15994 100644
--- a/core/vm/sqlvm/runtime/instructions_test.go
+++ b/core/vm/sqlvm/runtime/instructions_test.go
@@ -213,7 +213,7 @@ type opLoadTestCase struct {
func (s *opLoadSuite) SetupTest() {
s.ctx = &common.Context{}
s.ctx.Storage = s.newStorage()
- s.headHash = s.ctx.Storage.GetPrimaryKeyHash([]byte("Table_B"), uint64(123456))
+ s.headHash = s.ctx.Storage.GetRowPathHash([]byte("Table_B"), uint64(123456))
s.address = dexCommon.HexToAddress("0x6655")
s.ctx.Storage.CreateAccount(s.address)
s.ctx.Contract = vm.NewContract(vm.AccountRef(s.address),
@@ -224,7 +224,7 @@ func (s *opLoadSuite) SetupTest() {
}
func (s *opLoadSuite) setColData(tableName string, id uint64) {
- h := s.ctx.Storage.GetPrimaryKeyHash([]byte(tableName), id)
+ h := s.ctx.Storage.GetRowPathHash([]byte(tableName), id)
setSlotDataInStateDB(h, s.address, s.ctx.Storage)
}