-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add io component #59
Conversation
src/io/basic_io_test.h
Outdated
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/io/memory_block_io.h
Outdated
|
||
private: | ||
[[nodiscard]] inline bool | ||
checkValidOffset(uint64_t size) const { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/io/memory_block_io.h
Outdated
checkAndRealloc(uint64_t size); | ||
|
||
[[nodiscard]] inline const uint8_t* | ||
getDataPtr(uint64_t offset) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/io/memory_block_io.h
Outdated
} | ||
|
||
inline void | ||
checkAndRealloc(uint64_t size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/io/memory_block_io.h
Outdated
} | ||
|
||
[[nodiscard]] inline bool | ||
checkInOneBlock(uint64_t off1, uint64_t off2) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
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}; |
There was a problem hiding this comment.
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*
There was a problem hiding this comment.
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}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
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]>
issue #40