39 FileSpec(
string filehandler,
const vector<string>& chunks)
40 : fileHandlerName{std::move(filehandler)}, chunks{chunks} {}
41 FileSpec(
string filehandler,
const vector<string>&& chunks)
42 : fileHandlerName{std::move(filehandler)}, chunks{chunks} {}
43 explicit FileSpec(
const vector<string>& chunks) : chunks{chunks} {}
44 explicit FileSpec(vector<string>&& chunks) : chunks{std::move(chunks)} {}
51 bool isDiskFile()
const;
57 map<string, string>& outQueryParams);
65 int fromPathJsonUri(
const string& pathJsonUri,
const string& defaultFileHandlerName = {});
74 bool fromJson(
const string& jsonStr);
79 string toJson()
const;
102 const string&
getExtra(
const string& name)
const;
104 const string&
getExtra(
const string& name,
const string& defaultValue)
const;
106 bool hasExtra(
const string& name)
const;
109 int getExtraAsInt(
const string& name,
int defaultValue = 0)
const;
112 int64_t
getExtraAsInt64(
const string& name, int64_t defaultValue = 0)
const;
115 uint64_t
getExtraAsUInt64(
const string& name, uint64_t defaultValue = 0)
const;
121 bool getExtraAsBool(
const string& name,
bool defaultValue =
false)
const;
123 static int decodeQuery(
const string& query,
string& outKey,
string& outValue);
124 static int urldecode(
const string& in,
string& out);
126 void setExtra(
const string& name,
const string& value);
127 void setExtra(
const string& name,
const char* value);
128 void setExtra(
const string& name,
bool value);
129 template <
typename T>
130 void setExtra(
const string& name, T value) {
131 extras[name] = std::to_string(value);
137 string fileHandlerName;
140 vector<string> chunks;
141 vector<int64_t> chunkSizes;
142 map<string, string> extras;
Definition AsyncDiskFileChunk.hpp:49
Generalized file descriptor class, allowing the efficient representation of complex file objects,...
Definition FileSpec.h:37
double getExtraAsDouble(const string &name, double defaultValue=0) const
Definition FileSpec.cpp:415
uint64_t getExtraAsUInt64(const string &name, uint64_t defaultValue=0) const
Definition FileSpec.cpp:410
string toPathJsonUri() const
Reverse operation as fromPathJsonUri, as possible.
Definition FileSpec.cpp:186
bool hasChunkSizes() const
Tell if we have chunks and all of them has a file size.
Definition FileSpec.cpp:257
bool operator==(const FileSpec &rhs) const
Test equality (for testing)
Definition FileSpec.cpp:378
string getSourceLocation() const
Get the location of the object, which is the uri (if any), or the file handler.
Definition FileSpec.cpp:284
int parseUri()
Parse the uri field already set, overwriting other fields on success.
Definition FileSpec.cpp:249
int fromPathJsonUri(const string &pathJsonUri, const string &defaultFileHandlerName={})
Definition FileSpec.cpp:146
const string & getExtra(const string &name) const
Get an extra parameter, or the empty string.
Definition FileSpec.cpp:385
bool hasExtra(const string &name) const
Tell if an extra parameter is defined.
Definition FileSpec.cpp:396
int64_t getExtraAsInt64(const string &name, int64_t defaultValue=0) const
Definition FileSpec.cpp:405
int64_t getFileSize() const
Get the total size of the object, or -1 if don't know.
Definition FileSpec.cpp:261
bool getExtraAsBool(const string &name, bool defaultValue=false) const
Definition FileSpec.cpp:420
void unsetExtra(const string &name)
Unset an extra parameter.
Definition FileSpec.cpp:425
string getXXHash() const
Get signature of the path.
Definition FileSpec.cpp:362
int getExtraAsInt(const string &name, int defaultValue=0) const
Definition FileSpec.cpp:400
void clear()
clear all the fields.
Definition FileSpec.cpp:49
string getFileName() const
Get filename, if possible.
Definition FileSpec.cpp:352
string getEasyPath() const
Logical reverse operation from fromPathJsonUri, but kept minimal for logging.
Definition FileSpec.cpp:303