16 #ifndef IMPALA_RUNTIME_LIB_CACHE_H
17 #define IMPALA_RUNTIME_LIB_CACHE_H
20 #include <boost/scoped_ptr.hpp>
21 #include <boost/unordered_map.hpp>
22 #include <boost/unordered_set.hpp>
23 #include <boost/thread/mutex.hpp>
75 std::string* local_path);
80 const std::string& symbol,
bool quiet =
false);
95 void** fn_ptr, LibCacheEntry** entry,
bool quiet =
false);
106 void RemoveEntry(
const std::string& hdfs_lib_file);
128 typedef boost::unordered_map<std::string, LibCacheEntry*>
LibMap;
144 boost::unique_lock<boost::mutex>* entry_lock,
LibCacheEntry** entry);
149 boost::unique_lock<boost::mutex>* entry_lock,
LibCacheEntry** entry);
156 std::string
MakeLocalPath(
const std::string& hdfs_path,
const std::string& local_dir);
161 const LibMap::iterator& entry_iterator);
Status CheckSymbolExists(const std::string &hdfs_lib_file, LibType type, const std::string &symbol, bool quiet=false)
void RemoveEntryInternal(const std::string &hdfs_lib_file, const LibMap::iterator &entry_iterator)
AtomicInt< int64_t > num_libs_copied_
void * current_process_handle_
dlopen() handle for the current process (i.e. impalad).
static boost::scoped_ptr< LibCache > instance_
Singleton instance. Instantiated in Init().
~LibCache()
Calls dlclose on all cached handles.
LibCache & operator=(LibCache const &l)
Status GetCacheEntry(const std::string &hdfs_lib_file, LibType type, boost::unique_lock< boost::mutex > *entry_lock, LibCacheEntry **entry)
void RemoveEntry(const std::string &hdfs_lib_file)
Removes the cache entry for 'hdfs_lib_file'.
Status GetSoFunctionPtr(const std::string &hdfs_lib_file, const std::string &symbol, void **fn_ptr, LibCacheEntry **entry, bool quiet=false)
If 'quiet' is true, returned error statuses will not be logged.
Status GetCacheEntryInternal(const std::string &hdfs_lib_file, LibType type, boost::unique_lock< boost::mutex > *entry_lock, LibCacheEntry **entry)
Status GetLocalLibPath(const std::string &hdfs_lib_file, LibType type, std::string *local_path)
static LibCache * instance()
void DropCache()
Removes all cached entries.
void SetNeedsRefresh(const std::string &hdfs_lib_file)
std::string MakeLocalPath(const std::string &hdfs_path, const std::string &local_dir)
static Status Init()
Initializes the libcache. Must be called before any other APIs.
void DecrementUseCount(LibCacheEntry *entry)
See comment in GetSoFunctionPtr().
boost::unordered_map< std::string, LibCacheEntry * > LibMap