@@ -147,7 +147,6 @@ int run(int argc, char* argv[]) {
147
147
const auto rocksdb_conf = config[" rocksdb-config-file" ].as <std::string>();
148
148
const auto client_id = (config[" client-id" ].empty () ? std::string{} : config[" client-id" ].as <std::string>());
149
149
const auto ext_ev_group_id = config[" ext-event-group-id" ].as <std::int64_t >();
150
- (void )ext_ev_group_id;
151
150
152
151
if (point_lookup_batch_size < 1 ) {
153
152
std::cerr << " point-lookup-batch-size must be greater than or equal to 1" << std::endl;
@@ -168,7 +167,9 @@ int run(int argc, char* argv[]) {
168
167
}
169
168
auto thread_pool = ThreadPool{static_cast <std::uint32_t >(point_lookup_threads)};
170
169
171
- std::cout << " Prining ACS state {key, Hash(val)} with a point lookup batch size = " << point_lookup_batch_size
170
+ std::cout << " Hash state keys {H(H(k1)|H(v1) | H(k2)|H(v2) .....H(kn|vn))} acl-filtered for client id: " << client_id
171
+ << " , starting from an offset(event group id) " << ext_ev_group_id
172
+ << " , with a point lookup batch size = " << point_lookup_batch_size
172
173
<< " , point lookup threads = " << point_lookup_threads
173
174
<< " , RocksDB block cache size = " << rocksdb_cache_size << " bytes, configuration file = " << rocksdb_conf
174
175
<< " , DB path = " << rocksdb_path << std::endl;
@@ -220,8 +221,10 @@ int run(int argc, char* argv[]) {
220
221
static_cast <std::uint32_t >(point_lookup_threads)};
221
222
222
223
auto print_kv_with_acl = [&](const Buffer& buff, const auto & value, const auto & trids, bool is_public) {
224
+ // In actual application, we would probably stream state keys {k , hash(v) } over grpc
225
+ // here we are just printing it
223
226
std::ostringstream oss;
224
- const auto hash = Hash (SHA3_256 ().digest (value.data (), value.size ()));
227
+ const auto hash = Hash (SHA2_256 ().digest (value.data (), value.size ()));
225
228
oss << " key: " << bufferToHex (buff.data (), buff.size ()) << std::endl;
226
229
oss << " hash(val): " << bufferToHex (hash.data (), hash.size ()) << std::endl;
227
230
if (is_public)
@@ -241,7 +244,7 @@ int run(int argc, char* argv[]) {
241
244
std::cout << oss.str ();
242
245
};
243
246
244
- auto has_access = [&num_of_pvt_keys, &num_of_public_keys, &client_id](const auto & value, const auto & trids) -> bool {
247
+ auto has_access = [&num_of_pvt_keys, &num_of_public_keys, &client_id](const auto & trids) -> bool {
245
248
bool allowed = false ;
246
249
if (trids.size ()) {
247
250
for (const auto & trid : trids) {
@@ -321,15 +324,15 @@ int run(int argc, char* argv[]) {
321
324
auto v = std::unique_ptr<std::string>(proto.release_value ());
322
325
value.assign (std::move (*v));
323
326
for (auto & t : proto.trid ()) {
324
- trids.emplace_back (std::move (t) );
327
+ trids.emplace_back (t );
325
328
}
326
329
327
- if (has_access (*v, trids)) {
328
- hash_state_kv (serialized_keys[j], *v );
330
+ if (has_access (trids)) {
331
+ hash_state_kv (serialized_keys[j], value );
329
332
}
330
333
// print all state keys - hash(val), trid
331
- // auto is_public = trids.size() ? false : true;
332
- // print_kv_with_acl(serialized_keys[j], value, trids, is_public);
334
+ // auto is_public = trids.size() ? false : true;
335
+ // print_kv_with_acl(serialized_keys[j], value, trids, is_public);
333
336
++key_idx;
334
337
}
335
338
}
0 commit comments