@@ -361,29 +361,29 @@ FileReferenceShort create_persistent_state_id(BlockIdExt block_id, BlockIdExt mc
361361
362362} // namespace
363363
364- void ArchiveManager::add_persistent_state (BlockIdExt block_id, BlockIdExt masterchain_block_id, td::BufferSlice data,
364+ void ArchiveManager::add_persistent_state (BlockIdExt block_id, BlockIdExt masterchain_block_id,
365+ PersistentStateType type, td::BufferSlice data,
365366 td::Promise<td::Unit> promise) {
366367 auto create_writer = [&](std::string path, td::Promise<std::string> P) {
367368 td::actor::create_actor<db::WriteFile>(" writefile" , db_root_ + " /archive/tmp/" , std::move (path), std::move (data),
368369 std::move (P))
369370 .release ();
370371 };
371- // TODO: Allow specifying state type.
372- add_persistent_state_impl (create_persistent_state_id (block_id, masterchain_block_id, UnsplitStateType{}),
373- std::move (promise), std::move (create_writer));
372+ add_persistent_state_impl (create_persistent_state_id (block_id, masterchain_block_id, type), std::move (promise),
373+ std::move (create_writer));
374374}
375375
376376void ArchiveManager::add_persistent_state_gen (BlockIdExt block_id, BlockIdExt masterchain_block_id,
377+ PersistentStateType type,
377378 std::function<td::Status(td::FileFd &)> write_state,
378379 td::Promise<td::Unit> promise) {
379380 auto create_writer = [&](std::string path, td::Promise<std::string> P) {
380381 td::actor::create_actor<db::WriteFile>(" writefile" , db_root_ + " /archive/tmp/" , std::move (path),
381382 std::move (write_state), std::move (P))
382383 .release ();
383384 };
384- // TODO: Allow specifying state type.
385- add_persistent_state_impl (create_persistent_state_id (block_id, masterchain_block_id, UnsplitStateType{}),
386- std::move (promise), std::move (create_writer));
385+ add_persistent_state_impl (create_persistent_state_id (block_id, masterchain_block_id, type), std::move (promise),
386+ std::move (create_writer));
387387}
388388
389389void ArchiveManager::add_persistent_state_impl (
@@ -450,9 +450,8 @@ void ArchiveManager::get_previous_persistent_state_files(
450450}
451451
452452void ArchiveManager::get_persistent_state (BlockIdExt block_id, BlockIdExt masterchain_block_id,
453- td::Promise<td::BufferSlice> promise) {
454- // TODO: Allow specifying state type.
455- auto id = create_persistent_state_id (block_id, masterchain_block_id, UnsplitStateType{});
453+ PersistentStateType type, td::Promise<td::BufferSlice> promise) {
454+ auto id = create_persistent_state_id (block_id, masterchain_block_id, type);
456455 auto hash = id.hash ();
457456 if (perm_states_.find ({masterchain_block_id.seqno (), hash}) == perm_states_.end ()) {
458457 promise.set_error (td::Status::Error (ErrorCode::notready, " state file not in db" ));
@@ -463,10 +462,10 @@ void ArchiveManager::get_persistent_state(BlockIdExt block_id, BlockIdExt master
463462 td::actor::create_actor<db::ReadFile>(" readfile" , path, 0 , -1 , 0 , std::move (promise)).release ();
464463}
465464
466- void ArchiveManager::get_persistent_state_slice (BlockIdExt block_id, BlockIdExt masterchain_block_id, td::int64 offset,
467- td::int64 max_size , td::Promise<td::BufferSlice> promise) {
468- // TODO: Allow specifying state type.
469- auto id = create_persistent_state_id (block_id, masterchain_block_id, UnsplitStateType{} );
465+ void ArchiveManager::get_persistent_state_slice (BlockIdExt block_id, BlockIdExt masterchain_block_id,
466+ PersistentStateType type, td::int64 offset , td::int64 max_size,
467+ td::Promise<td::BufferSlice> promise) {
468+ auto id = create_persistent_state_id (block_id, masterchain_block_id, type );
470469 auto hash = id.hash ();
471470 if (perm_states_.find ({masterchain_block_id.seqno (), hash}) == perm_states_.end ()) {
472471 promise.set_error (td::Status::Error (ErrorCode::notready, " state file not in db" ));
@@ -478,9 +477,8 @@ void ArchiveManager::get_persistent_state_slice(BlockIdExt block_id, BlockIdExt
478477}
479478
480479void ArchiveManager::get_persistent_state_file_size (BlockIdExt block_id, BlockIdExt masterchain_block_id,
481- td::Promise<td::uint64> promise) {
482- // TODO: Allow specifying state type.
483- auto id = create_persistent_state_id (block_id, masterchain_block_id, UnsplitStateType{});
480+ PersistentStateType type, td::Promise<td::uint64> promise) {
481+ auto id = create_persistent_state_id (block_id, masterchain_block_id, type);
484482 auto hash = id.hash ();
485483 auto it = perm_states_.find ({masterchain_block_id.seqno (), hash});
486484 if (it == perm_states_.end ()) {
0 commit comments