提交 3ca394c3 编写于 作者: D Daniel Larimer

fix back_secondary_i128i182

上级 fb2fa941
......@@ -61,9 +61,9 @@ namespace eos { namespace chain {
OBJECT_CTOR(key128x128_value_object, (value))
id_type id;
uint64_t scope;
uint64_t code;
uint64_t table;
AccountName scope;
AccountName code;
AccountName table;
uint128_t primary_key;
uint128_t secondary_key;
shared_string value;
......@@ -77,9 +77,9 @@ namespace eos { namespace chain {
ordered_unique<tag<by_id>, member<key128x128_value_object, key128x128_value_object::id_type, &key128x128_value_object::id>>,
ordered_unique<tag<by_scope_primary>,
composite_key< key128x128_value_object,
member<key128x128_value_object, uint64_t, &key128x128_value_object::scope>,
member<key128x128_value_object, uint64_t, &key128x128_value_object::code>,
member<key128x128_value_object, uint64_t, &key128x128_value_object::table>,
member<key128x128_value_object, AccountName, &key128x128_value_object::scope>,
member<key128x128_value_object, AccountName, &key128x128_value_object::code>,
member<key128x128_value_object, AccountName, &key128x128_value_object::table>,
member<key128x128_value_object, uint128_t, &key128x128_value_object::primary_key>,
member<key128x128_value_object, uint128_t, &key128x128_value_object::secondary_key>
>,
......@@ -87,9 +87,9 @@ namespace eos { namespace chain {
>,
ordered_unique<tag<by_scope_secondary>,
composite_key< key128x128_value_object,
member<key128x128_value_object, uint64_t, &key128x128_value_object::scope>,
member<key128x128_value_object, uint64_t, &key128x128_value_object::code>,
member<key128x128_value_object, uint64_t, &key128x128_value_object::table>,
member<key128x128_value_object, AccountName, &key128x128_value_object::scope>,
member<key128x128_value_object, AccountName, &key128x128_value_object::code>,
member<key128x128_value_object, AccountName, &key128x128_value_object::table>,
member<key128x128_value_object, uint128_t, &key128x128_value_object::secondary_key>,
member<key128x128_value_object, uint128_t, &key128x128_value_object::primary_key>
>
......
......@@ -94,7 +94,6 @@ int32_t message_validate_context::back_primary_i128i128( Name scope, Name code,
int32_t message_validate_context::back_secondary_i128i128( Name scope, Name code, Name table,
uint128_t* primary, uint128_t* secondary, char* value, uint32_t valuelen ) {
/*
require_scope( scope );
const auto& idx = db.get_index<key128x128_value_index,by_scope_secondary>();
auto itr = idx.lower_bound( boost::make_tuple( AccountName(scope),
......@@ -102,15 +101,15 @@ int32_t message_validate_context::back_secondary_i128i128( Name scope, Name code
table.value+1,
*secondary, uint128_t(0) ) );
if( itr == idx.begin() && itr == idx.end() )
return 0;
if( itr == idx.end() )
return -1;
--itr;
if( itr->scope != scope ||
itr->code != code ||
itr->table != table ||
itr->primary_key != *primary ) return -1;
itr->table != table
) return -2;
*secondary = itr->secondary_key;
*primary = itr->primary_key;
......@@ -120,15 +119,12 @@ int32_t message_validate_context::back_secondary_i128i128( Name scope, Name code
itr->value.copy(value, copylen);
}
return copylen;
*/
return -1;
}
int32_t message_validate_context::front_primary_i128i128( Name scope, Name code, Name table,
uint128_t* primary, uint128_t* secondary, char* value, uint32_t valuelen ) {
/*
require_scope( scope );
const auto& idx = db.get_index<key128x128_value_index,by_scope_primary>();
auto itr = idx.lower_bound( boost::make_tuple( uint64_t(scope),
......@@ -143,8 +139,8 @@ int32_t message_validate_context::front_primary_i128i128( Name scope, Name code,
if( itr->scope != scope ||
itr->code != code ||
itr->table != table ||
itr->primary_key != *primary ) return -1;
itr->table != table
) return -2;
*secondary = itr->secondary_key;
*primary = itr->primary_key;
......@@ -154,61 +150,29 @@ int32_t message_validate_context::front_primary_i128i128( Name scope, Name code,
itr->value.copy(value, copylen);
}
return copylen;
*/
return -1;
}
int32_t message_validate_context::front_secondary_i128i128( Name scope, Name code, Name table,
uint128_t* primary, uint128_t* secondary, char* value, uint32_t valuelen ) {
require_scope( scope );
const auto& idx = db.get_index<key128x128_value_index,by_scope_secondary>();
/*
auto itr = idx.lower_bound( boost::make_tuple( AccountName(scope),
AccountName(code),
AccountName(table),
uint128_t(0), uint128_t(0) ) );
*/
auto itr = idx.lower_bound( boost::make_tuple( uint64_t(0ull),
uint64_t(0ull),
uint64_t(0ull),
uint128_t(0),
uint128_t(0)) );
wdump((scope)(code)(table));
idump((idx.size()));
for( const auto& item : idx ) {
auto tup = boost::make_tuple( item.scope, item.code, item.table, item.primary_key, item.secondary_key );
auto in = boost::make_tuple( AccountName(scope), AccountName(code), AccountName(table),
uint128_t(1), uint128_t(1) );
idump( (scope)(code)(table)(fc::uint128(*primary))(fc::uint128(*secondary)) );
if( item.scope == uint64_t(scope) )
if( item.code == uint64_t(code) )
if( item.table == uint64_t(table) )
{
ilog( "matching scope, code, table" );
/*
if( item.secondary_key >= uint128_t(0) ) {
idump( "secondary_key >= 0" );
if( item.primary_key >= uint128_t(0) )
idump( "primary_key >= 0" );
}
*/
}
wdump( (item.scope)(item.code)(item.table)(fc::uint128(item.primary_key))(fc::uint128(item.secondary_key)) );
}
ilog(".");
if( itr == idx.end() )
FC_ASSERT( itr == idx.begin(), "lower bound of all 0 should be begin" );
if( itr == idx.end() ) {
return -1;
}
/*
--itr;
if( itr->scope != scope ||
itr->code != code ||
itr->table != table ||
itr->primary_key != *primary ) return -1;
itr->table != table ) {
return -2;
}
*secondary = itr->secondary_key;
*primary = itr->primary_key;
......@@ -218,8 +182,6 @@ int32_t message_validate_context::front_secondary_i128i128( Name scope, Name cod
itr->value.copy(value, copylen);
}
return copylen;
*/
return -1;
}
......@@ -234,9 +196,9 @@ int32_t message_validate_context::load_primary_i128i128( Name scope, Name code,
*primary, uint128_t(0) ) );
if( itr == idx.end() ||
itr->scope != uint64_t(scope) ||
itr->code != uint64_t(code) ||
itr->table != uint64_t(table) ||
itr->scope != (scope) ||
itr->code != (code) ||
itr->table != (table) ||
itr->primary_key != *primary ) return -1;
*secondary = itr->secondary_key;
......@@ -250,7 +212,6 @@ int32_t message_validate_context::load_primary_i128i128( Name scope, Name code,
int32_t message_validate_context::lowerbound_primary_i128i128( Name scope, Name code, Name table,
uint128_t* primary, uint128_t* secondary, char* value, uint32_t valuelen ) {
/*
require_scope( scope );
const auto& idx = db.get_index<key128x128_value_index,by_scope_primary>();
auto itr = idx.lower_bound( boost::make_tuple( uint64_t(scope),
......@@ -271,14 +232,11 @@ int32_t message_validate_context::lowerbound_primary_i128i128( Name scope, Name
itr->value.copy(value, copylen);
}
return copylen;
*/
return -1;
}
int32_t message_validate_context::lowerbound_secondary_i128i128( Name scope, Name code, Name table,
uint128_t* primary, uint128_t* secondary, char* value, uint32_t valuelen ) {
/*
require_scope( scope );
const auto& idx = db.get_index<key128x128_value_index,by_scope_secondary>();
auto itr = idx.lower_bound( boost::make_tuple( uint64_t(scope),
......@@ -299,8 +257,6 @@ int32_t message_validate_context::lowerbound_secondary_i128i128( Name scope, Nam
itr->value.copy(value, copylen);
}
return copylen;
*/
return -1;
}
int32_t apply_context::remove_i64( Name scope, Name table, Name key ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册