Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add io component #59

Merged
merged 1 commit into from
Oct 11, 2024
Merged

Add io component #59

merged 1 commit into from
Oct 11, 2024

Conversation

LHT129
Copy link
Collaborator

@LHT129 LHT129 commented Oct 11, 2024

issue #40

  • implement memory block io
  • io test for read&write
  • io test for serialize&deserialize
  • add common index param
  • add datatype

std::vector<uint64_t> max_lengths = {2, 20, 37, 64, 128, 260, 999, 4097};
srandom(time(nullptr));
std::string dirname = "/tmp/random_TestSerializeAndDeserialize_" + std::to_string(random());
std::filesystem::create_directory(dirname);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use fixtures::temp_dir to create tmp directory for testing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


private:
[[nodiscard]] inline bool
checkValidOffset(uint64_t size) const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkValidOffset to check_valid_offset

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

checkAndRealloc(uint64_t size);

[[nodiscard]] inline const uint8_t*
getDataPtr(uint64_t offset) const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

inline void
checkAndRealloc(uint64_t size);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

[[nodiscard]] inline bool
checkInOneBlock(uint64_t off1, uint64_t off2) const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


std::vector<uint8_t*> blocks_{};

Allocator* const allocator_{nullptr};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allocator* const to const Allocator*

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think T* const is better

@@ -68,7 +82,7 @@ class MemoryIO : public BasicIO<MemoryIO> {
}

private:
Allocator* allocator_{nullptr};
Allocator* const allocator_{nullptr};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think T* const is better

- implement memory block io
- io test for read&write
- io test for serialize&deserialize
- add common index param
- add datatype

Signed-off-by: LHT129 <[email protected]>
@LHT129 LHT129 removed the request for review from wxyucs October 11, 2024 08:46
@LHT129 LHT129 merged commit 7f7208f into main Oct 11, 2024
2 checks passed
@LHT129 LHT129 deleted the io_implement branch October 11, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants