google::protobuf::Message* TestRPCServerMRC::OpenOperation( const pbrpc::Auth& auth, const pbrpc::UserCredentials& user_credentials, const google::protobuf::Message& request, const char* data, uint32_t data_len, boost::scoped_array<char>* response_data, uint32_t* response_data_len) { const openRequest* rq = reinterpret_cast<const openRequest*>(&request); openResponse* response = new openResponse(); XCap* xcap = response->mutable_creds()->mutable_xcap(); xcap->set_access_mode(rq->flags()); xcap->set_client_identity("client_identity"); xcap->set_expire_time_s(3600); xcap->set_expire_timeout_s(static_cast<uint32_t>(time(0)) + 3600); xcap->set_file_id(rq->volume_name() + ":0"); xcap->set_replicate_on_close(false); xcap->set_server_signature("signature"); xcap->set_snap_config(SNAP_CONFIG_SNAPS_DISABLED); xcap->set_snap_timestamp(0); xcap->set_truncate_epoch(0); xcap->set_voucher_size(0); struct timeval tp; gettimeofday(&tp, NULL); xcap->set_expire_time_ms(tp.tv_sec * 1000 + tp.tv_usec / 1000); XLocSet* xlocset = response->mutable_creds()->mutable_xlocs(); xlocset->set_read_only_file_size(file_size_); xlocset->set_replica_update_policy(""); // "" = REPL_UPDATE_PC_NONE; xlocset->set_version(0); xlocset->add_replicas(); Replica* replica = xlocset->mutable_replicas(0); replica->set_replication_flags(0); for (std::vector<std::string>::iterator it = osd_uuids_.begin(); it != osd_uuids_.end(); ++it) { replica->add_osd_uuids(*it); } replica->mutable_striping_policy()->set_type(STRIPING_POLICY_RAID0); replica->mutable_striping_policy()->set_stripe_size(128); replica->mutable_striping_policy()->set_width(1); response->set_timestamp_s(static_cast<uint32_t>(time(0))); return response; }