結果圖如下:
./rados -p default.rgw.buckets.data listomapkeysca1f567f-841f-415f-bb5d-5fd1cfe9e757.14107.1_1.mp4
ca1f567f-841f-415f-bb5d-5fd1cfe9e757.14107.1_1.mp4 相當於是字典,這個是存入的object的head object.
default.rgw.torrent 是字典中的單詞
torrent data 是字典內容
檢視torrent資料檔案命令:
./rados -p default.rgw.buckets.data listomapvals ca1f567f-841f-415f-bb5d-5fd1cfe9e757.14107.1_1.mp4
在put object時儲存torrent data到omap中的**實現:
**是在put object中實現的
if (ofs == torrent.get_data_len())
{rgw_obj obj(s->bucket, s->object.name);
bufferlist bl_torrent;
uint64_t total_len = 0;
torrent.init(s, store);
op_ret = torrent.handle_data(bl_torrent, total_len, obj);--------------------呼叫了下面的函式
if (0 != op_ret)
{info "handle_data fail op_ret= "<
如何獲取到存在omap中的資料呢?呼叫如下方法,在get object中實現
// start gettorrent
if (torrent.get_flag())
torrent.get_torrent_file(op_ret, read_op, total_len, bl, obj);
if (op_ret < 0)
ldout(s->cct, 0) << "error: failed to get_torrent_file ret= " << op_ret
<< dendl;
goto done_err;
op_ret = send_response_data(bl, 0, total_len);
if (op_ret < 0)
ldout(s->cct, 0) << "error: failed to send_response_data ret= " << op_ret
<< dendl;
goto done_err;
return;
// end gettorrent
void seed::get_torrent_file(int &op_ret, rgwrados::object::read &read_op, uint64_t &total_len,
bufferlist &bl_data, rgw_obj &obj)
string oid, key;
rgw_bucket bucket;
mapm;
setobj_key;
get_obj_bucket_and_oid_loc(obj, bucket, oid, key);----------------獲取oid也就是之前的 ca1f567f-841f-415f-bb5d-5fd1cfe9e757.14107.1_1.mp4
info "oid = " << oid << dendl;
obj_key.insert(rgw_obj_torrent);
op_ret = read_op.state.io_ctx.omap_get_vals_by_keys(oid, obj_key, &m);
if (op_ret < 0)
info "failed to omap_get_all ret=" << op_ret << dendl;
return;
map::iterator iter;
for (iter = m.begin(); iter != m.end(); ++iter)
bufferlist bl_tmp = iter->second;
char *pbuff = bl_tmp.c_str();
bl_data = bl;
total_len = bl.length();
return;
怎麼在android 上獲取檔案路徑
std string namebuf ccfileutils sharedfileutils fullpathforfilename string getcstring 我用的這個方法 在xcode 上是 在 eclispe 上是 assets 3.txt 我要 進行檔案操作 file pf pf ...
在windows上獲取檔案建立時間
目前在windows上測試成功,linux上可能是由問題的,在網上找了些資料,結合自己除錯結果,最終如下 遞迴獲取檔案 listfilelist new treelist public listfiles file file else return filelist 匯入測試環境 test publ...
在android裝置上獲取內網IP
需要用到的許可權 返回wifi位址的整數表示,如果wifi未開啟或者接入返回0 private int getwifi return ip 整數轉換成ip的形式 private string inttoip int i 獲取手機的gprs位址 private string getlocalipadd...