MCPcopy Create free account
hub / github.com/apache/impala / InsertIntoCache

Method InsertIntoCache

be/src/kudu/util/file_cache.cc:129–139  ·  view source on GitHub ↗

Insert a pointer to an open file object into the file cache with the filename as the cache key. Returns a handle to the inserted entry. The handle always contains an open file.

Source from the content-addressed store, hash-verified

127 // Returns a handle to the inserted entry. The handle always contains an open
128 // file.
129 ScopedOpenedDescriptor<FileType> InsertIntoCache(void* file_ptr) const {
130 // The allocated charge is always one byte. This is incorrect with respect
131 // to memory tracking, but it's necessary if the cache capacity is to be
132 // equivalent to the max number of fds.
133 auto pending(cache()->Allocate(filename(), sizeof(file_ptr), 1));
134 CHECK(pending);
135 memcpy(cache()->MutableValue(&pending), &file_ptr, sizeof(file_ptr));
136 return ScopedOpenedDescriptor<FileType>(
137 this, cache()->Insert(std::move(pending),
138 file_cache_->eviction_cb_.get()));
139 }
140
141 // Retrieves a pointer to an open file object from the file cache with the
142 // filename as the cache key.

Callers 2

ReopenFileIfNecessaryMethod · 0.45
ReopenFileIfNecessaryMethod · 0.45

Calls 5

moveFunction · 0.85
getMethod · 0.65
AllocateMethod · 0.45
MutableValueMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected