int ResumableDownloader::prepare()

in sdk/src/resumable/ResumableDownloader.cc [302:334]


int ResumableDownloader::prepare(PdsError& err)
{
    UNUSED_PARAM(err);

    determinePartSize();
    if (hasRecordPath()) {
        initRecordInfo();

        Json::Value root;
        root["opType"] = record_.opType;
        root["driveID"] = record_.driveID;
        root["shareID"] = record_.shareID;
        root["fileID"] = record_.fileID;
        root["contentHash"] = record_.contentHash;
        root["filePath"] = record_.filePath;
        root["mtime"] = record_.mtime;
        root["size"] = record_.size;
        root["partSize"] = record_.partSize;
        root["parts"].resize(0);

        std::stringstream ss;
        ss << root;
        std::string md5Sum = ComputeContentETag(ss);
        root["md5Sum"] = md5Sum;

        auto recordStream = GetFstreamByPath(recordPath_, recordPathW_, std::ios::out);
        if (recordStream->is_open()) {
            *recordStream << root;
            recordStream->close();
        }
    }
    return 0;
}