@@ -46,19 +46,19 @@ class MemoryIO : public BasicIO<MemoryIO> {
4646 this ->allocator_ ->Deallocate (start_);
4747 }
4848
49- inline void
49+ void
5050 WriteImpl (const uint8_t * data, uint64_t size, uint64_t offset);
5151
52- inline bool
52+ bool
5353 ReadImpl (uint64_t size, uint64_t offset, uint8_t * data) const ;
5454
55- [[nodiscard]] inline const uint8_t *
55+ [[nodiscard]] const uint8_t *
5656 DirectReadImpl (uint64_t size, uint64_t offset, bool & need_release) const ;
5757
58- inline bool
58+ bool
5959 MultiReadImpl (uint8_t * datas, uint64_t * sizes, uint64_t * offsets, uint64_t count) const ;
6060
61- inline void
61+ void
6262 PrefetchImpl (uint64_t offset, uint64_t cache_line = 64 );
6363
6464private:
@@ -74,41 +74,4 @@ class MemoryIO : public BasicIO<MemoryIO> {
7474private:
7575 uint8_t * start_{nullptr };
7676};
77-
78- void
79- MemoryIO::WriteImpl (const uint8_t * data, uint64_t size, uint64_t offset) {
80- check_and_realloc (size + offset);
81- memcpy (start_ + offset, data, size);
82- }
83-
84- bool
85- MemoryIO::ReadImpl (uint64_t size, uint64_t offset, uint8_t * data) const {
86- bool ret = check_valid_offset (size + offset);
87- if (ret) {
88- memcpy (data, start_ + offset, size);
89- }
90- return ret;
91- }
92-
93- const uint8_t *
94- MemoryIO::DirectReadImpl (uint64_t size, uint64_t offset, bool & need_release) const {
95- need_release = false ;
96- if (check_valid_offset (size + offset)) {
97- return start_ + offset;
98- }
99- return nullptr ;
100- }
101- bool
102- MemoryIO::MultiReadImpl (uint8_t * datas, uint64_t * sizes, uint64_t * offsets, uint64_t count) const {
103- bool ret = true ;
104- for (uint64_t i = 0 ; i < count; ++i) {
105- ret &= this ->ReadImpl (sizes[i], offsets[i], datas);
106- datas += sizes[i];
107- }
108- return ret;
109- }
110- void
111- MemoryIO::PrefetchImpl (uint64_t offset, uint64_t cache_line) {
112- PrefetchLines (this ->start_ + offset, cache_line);
113- }
11477} // namespace vsag
0 commit comments