feat: buffer storage write#414
Open
iaojnh wants to merge 57 commits into
Open
Conversation
14cc3fe to
235cffd
Compare
Collaborator
|
collection unit test 里可以加一下 enable mmap = false 的测试,可以复用已有的,把 collection 初始化参数改下 |
richyreachy
reviewed
May 29, 2026
| VecBufferPool::VecBufferPool(const std::string &filename, bool writable, | ||
| bool create) { | ||
| file_name_ = filename; | ||
| writable_ = writable || create; |
Collaborator
There was a problem hiding this comment.
这里writable等于false,create 等于 true 会把writable设置为true,是否符合预期,还是要增加校验
Collaborator
Author
There was a problem hiding this comment.
create这个参数在这里没用,文件初始化在buffer storage的open方法完成。
这里只区分是否可写入,create参数移除。
richyreachy
reviewed
May 29, 2026
| char *buf, size_t sz, | ||
| size_t off) -> int { | ||
| #if defined(_MSC_VER) | ||
| ssize_t w = zvec_pwrite(fd, buf, sz, off); |
Collaborator
There was a problem hiding this comment.
这个宏判断可以放到zvec_pwrite里
Collaborator
Author
There was a problem hiding this comment.
done,外层统一调用zvec_pwrite,具体平台用宏判断。
richyreachy
reviewed
May 29, 2026
| // size to be a multiple of alignment. | ||
| const size_t kAlign = 4096UL; | ||
| size_t alloc_size = (len + (kAlign - 1UL)) & ~(kAlign - 1UL); | ||
| char *tmp = |
Collaborator
Author
There was a problem hiding this comment.
这个后面单独开个pr改吧,这里就不添加pr的复杂度了
richyreachy
reviewed
May 29, 2026
| } | ||
| if (ailego::Crc32c::Hash(&header_, sizeof(header_), header_.header_crc) != | ||
| header_.header_crc) { | ||
| if (ailego::Crc32c::Hash(out, sizeof(*out), out->header_crc) != |
Collaborator
There was a problem hiding this comment.
sizeof(IndexFormat::MetaHeader)容易理解
Collaborator
Author
There was a problem hiding this comment.
constexpr size_t kHeaderSize = sizeof(IndexFormat::MetaHeader);
统一成了kHeaderSize。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
base on #406