redisValues.push_back("bucketName");
redisValues.push_back(object->bucketName);
redisValues.push_back("creationTime");
- redisValues.push_back(std::to_string(object->creationTime));
+ redisValues.push_back(object->creationTime);
redisValues.push_back("dirty");
redisValues.push_back(std::to_string(object->dirty));
redisValues.push_back("objHosts");
object->objName = std::get<0>(resp).value()[0];
object->bucketName = std::get<0>(resp).value()[1];
- object->creationTime = boost::lexical_cast<time_t>(std::get<0>(resp).value()[2]);
+ object->creationTime = std::get<0>(resp).value()[2];
object->dirty = boost::lexical_cast<bool>(std::get<0>(resp).value()[3]);
{
redisValues.push_back("bucketName");
redisValues.push_back(block->cacheObj.bucketName);
redisValues.push_back("creationTime");
- redisValues.push_back(std::to_string(block->cacheObj.creationTime));
+ redisValues.push_back(block->cacheObj.creationTime);
redisValues.push_back("dirty");
redisValues.push_back(std::to_string(block->cacheObj.dirty));
redisValues.push_back("objHosts");
block->cacheObj.objName = std::get<0>(resp).value()[5];
block->cacheObj.bucketName = std::get<0>(resp).value()[6];
- block->cacheObj.creationTime = boost::lexical_cast<time_t>(std::get<0>(resp).value()[7]);
+ block->cacheObj.creationTime = std::get<0>(resp).value()[7];
block->cacheObj.dirty = boost::lexical_cast<bool>(std::get<0>(resp).value()[8]);
{
const std::lock_guard l(d4n_get_data_lock);
rgw::d4n::CacheBlock block;
rgw::d4n::BlockDirectory* blockDir = source->driver->get_block_dir();
- block.version = "";
+ block.version = ""; // TODO: initialize correctly
block.hostsList.push_back(blockDir->cct->_conf->rgw_local_cache_address);
block.cacheObj.objName = source->get_key().get_oid();
block.cacheObj.bucketName = source->get_bucket()->get_name();
- block.cacheObj.creationTime = 0;
- block.cacheObj.dirty = false;// update hostsList since may overwrite existing hosts -Sam
- block.cacheObj.hostsList.push_back(blockDir->cct->_conf->rgw_local_cache_address); // Is the entire object getting stored in the local cache as well or only blocks? -Sam
- Attrs attrs; // empty attrs for block sets
+ block.cacheObj.creationTime = to_iso_8601(source->get_mtime());
+ block.cacheObj.dirty = false;
+ Attrs attrs; // empty attrs for cache sets
if (bl.length() > 0 && last_part) { // if bl = bl_rem has data and this is the last part, write it to cache
std::string oid = this->oid + "_" + std::to_string(ofs) + "_" + std::to_string(bl_len);
- block.blockID = ofs; // TODO: fill out block correctly
+ block.blockID = ofs;
block.size = bl.length();
if (filter->get_policy_driver()->get_cache_policy()->eviction(dpp, block.size, *y) == 0) {
if (filter->get_cache_driver()->put_async(dpp, oid, bl, bl.length(), attrs) == 0) {
if (bl_rem.length() == rgw_get_obj_max_req_size) {
std::string oid = this->oid + "_" + std::to_string(ofs) + "_" + std::to_string(bl_rem.length());
ofs += bl_rem.length();
- block.blockID = ofs; // TODO: fill out block correctly
+ block.blockID = ofs;
block.size = bl_rem.length();
if (filter->get_policy_driver()->get_cache_policy()->eviction(dpp, block.size, *y) == 0) {
if (filter->get_cache_driver()->put_async(dpp, oid, bl_rem, bl_rem.length(), attrs) == 0) {
int D4NFilterObject::D4NFilterDeleteOp::delete_obj(const DoutPrefixProvider* dpp,
optional_yield y, uint32_t flags)
{
- rgw::d4n::CacheBlock block = rgw::d4n::CacheBlock{
- .cacheObj = {
- .objName = source->get_key().get_oid(),
- .bucketName = source->get_bucket()->get_name()
- },
- .blockID = 0 // TODO: get correct blockID
- };
- if (source->driver->get_block_dir()->del(&block, y) < 0)
- ldpp_dout(dpp, 10) << "D4NFilterObject::" << __func__ << "(): BlockDirectory del method failed." << dendl;
+ rgw::d4n::CacheObj obj = rgw::d4n::CacheObj{ // TODO: Add logic to ObjectDirectory del method to also delete all blocks belonging to that object
+ .objName = source->get_key().get_oid(),
+ .bucketName = source->get_bucket()->get_name()
+ };
+
+ if (source->driver->get_obj_dir()->del(&obj, y) < 0)
+ ldpp_dout(dpp, 10) << "D4NFilterObject::" << __func__ << "(): ObjectDirectory del method failed." << dendl;
Attrs::iterator attrs;
Attrs currentattrs = source->get_attrs();
const req_context& rctx,
uint32_t flags)
{
- rgw::d4n::CacheBlock block = rgw::d4n::CacheBlock{
- .cacheObj = {
- .objName = obj->get_key().get_oid(),
- .bucketName = obj->get_bucket()->get_name(),
- .creationTime = 0, // TODO: get correct value
- .dirty = false,
- .hostsList = { driver->get_block_dir()->cct->_conf->rgw_local_cache_address }
- },
- .blockID = 0, // TODO: get correct blockID
- .version = "",
- .size = accounted_size,
- .hostsList = { driver->get_block_dir()->cct->_conf->rgw_local_cache_address }
+ rgw::d4n::CacheObj object = rgw::d4n::CacheObj{
+ .objName = obj->get_key().get_oid(),
+ .bucketName = obj->get_bucket()->get_name(),
+ .creationTime = to_iso_8601(*mtime),
+ .dirty = false,
+ .hostsList = { driver->get_block_dir()->cct->_conf->rgw_local_cache_address }
};
- if (driver->get_block_dir()->set(&block, y) < 0)
- ldpp_dout(save_dpp, 10) << "D4NFilterWriter::" << __func__ << "(): BlockDirectory set method failed." << dendl;
+ if (driver->get_obj_dir()->set(&object, y) < 0)
+ ldpp_dout(save_dpp, 10) << "D4NFilterWriter::" << __func__ << "(): ObjectDirectory set method failed." << dendl;
/* Retrieve complete set of attrs */
int ret = next->complete(accounted_size, etag, mtime, set_mtime, attrs,
obj = new rgw::d4n::CacheObj{
.objName = "testName",
.bucketName = "testBucket",
- .creationTime = 0,
+ .creationTime = "",
.dirty = false,
.hostsList = { env->redisHost }
};
net::io_context io;
connection* conn;
- std::vector<std::string> vals{"testName", "testBucket", "0", "0", env->redisHost};
+ std::vector<std::string> vals{"testName", "testBucket", "", "0", env->redisHost};
std::vector<std::string> fields{"objName", "bucketName", "creationTime", "dirty", "objHosts"};
};
.cacheObj = {
.objName = "testName",
.bucketName = "testBucket",
- .creationTime = 0,
+ .creationTime = "",
.dirty = false,
.hostsList = { env->redisHost }
},
connection* conn;
std::vector<std::string> vals{"0", "", "0", "0", env->redisHost,
- "testName", "testBucket", "0", "0", env->redisHost};
+ "testName", "testBucket", "", "0", env->redisHost};
std::vector<std::string> fields{"blockID", "version", "size", "globalWeight", "blockHosts",
"objName", "bucketName", "creationTime", "dirty", "objHosts"};
};