implemented support for multiple proxies

This commit is contained in:
Manfred Klimt 2018-06-28 13:25:11 +02:00
parent 82514f2b52
commit 71d7f96944
35 changed files with 156 additions and 111 deletions

View file

@ -91,13 +91,11 @@ XCodecCacheCOSS::~XCodecCacheCOSS()
delete[] directory_;
/*
INFO(log_) << "Stats: ";
INFO(log_) << "\tLookups=" << stats_.lookups;
INFO(log_) << "\tHits=" << (stats_.found_1 + stats_.found_2) << " (" << stats_.found_1 << " + " << stats_.found_2 << ")";
if (stats_.lookups > 0)
INFO(log_) << "\tHit ratio=" << ((stats_.found_1 + stats_.found_2) * 100) / stats_.lookups << "%";
*/
DEBUG(log_) << "Closing coss file: " << file_path_;
DEBUG(log_) << "Serial: " << serial_number_;
@ -195,13 +193,15 @@ bool XCodecCacheCOSS::lookup (const uint64_t& hash, Buffer& buf)
int slot;
stats_.lookups++;
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
if ((data = find_recent (hash)))
{
buf.append (data, XCODEC_SEGMENT_LENGTH);
stats_.found_1++;
return true;
}
#endif
if (! (entry = cache_index_.lookup (hash)))
return false;
@ -227,7 +227,9 @@ bool XCodecCacheCOSS::lookup (const uint64_t& hash, Buffer& buf)
stripe_[slot].header.flags[entry->position] |= 3;
data = stripe_[slot].segment_array[entry->position].bytes;
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
remember (hash, data);
#endif
buf.append (data, XCODEC_SEGMENT_LENGTH);
stats_.found_2++;
return true;
@ -337,7 +339,9 @@ void XCodecCacheCOSS::detach_stripe (int slot)
{
if (stripe_[slot].header.flags[i] & 1)
{
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
forget (stripe_[slot].header.hash_array[i]);
#endif
stripe_[slot].header.flags[i] &= ~1;
}
}

View file

@ -79,7 +79,7 @@ using namespace std;
#define CACHE_SIGNATURE 0xF150E964
#define CACHE_VERSION 2
#define STRIPE_SEGMENT_COUNT 512 // segments of XCODEC_SEGMENT_LENGTH per stripe (must fit into 16 bits)
#define LOADED_STRIPE_COUNT 4 // number of stripes held in memory (must be greater than 1)
#define LOADED_STRIPE_COUNT 16 // number of stripes held in memory (must be greater than 1)
#define CACHE_BASIC_SIZE 1024 // MB
#define CACHE_ALIGNEMENT 4096
@ -89,6 +89,8 @@ using namespace std;
#define HEADER_ALIGNED_SIZE ROUND_UP(HEADER_ARRAY_SIZE + METADATA_SIZE, CACHE_ALIGNEMENT)
#define METADATA_PADDING (HEADER_ALIGNED_SIZE - HEADER_ARRAY_SIZE - METADATA_SIZE)
#define USING_XCODEC_CACHE_RECENT_WINDOW
struct COSSIndexEntry
{
uint64_t stripe_range : 48;