http_code,
const string& http_text,
const stringwhen)
114os <<
"'"<< http_code <<
"|"<< http_text <<
"' "<< when <<
" "<< object_loc;
125os <<
"'"<< io_code <<
"|"<< io_text <<
"' "<< when <<
" "<< object_loc;
131 const char*,
void*,
int)
171 "'foreign site objects are forbidden' "<<
177 return "https://submit.ncbi.nlm.nih.gov";
180 return "https://qsubmit.ncbi.nlm.nih.gov";
183 return "https://dsubmit.ncbi.nlm.nih.gov";
190 case eDownload:
return "/api/2.0/files/"+
key+
"/?format=attachment";
191 case eUpload:
return "/api/2.0/uploads/binary/";
192 case eLocks:
return "/api/2.0/pins/";
193 default:
return "/api/2.0/files/"+
key+
"/";
203 const string& user_header,
206m_ObjectLoc(object_loc),
224 const string& user_header,
239 if(!my_ncbi_id.empty()) apply(my_ncbi_id);
247user_header.append(
"Content-Type: plain/text\r\n");
249user_header.append(
"\r\nFile-ID: ").append(object_loc.
GetUniqueKey());
250user_header.append(
"\r\nFile-Editable: true\r\n");
255user_header.append(my_ncbi_id);
256user_header.append(
"\r\n");
274 size_t count,
size_t* bytes_written)
280 if(bytes_written !=
NULL)
281*bytes_written =
count;
290 stringactual_key = upload_result.
GetString(
"key");
292 if(actual_key != expected_key) {
299 inthttp_code,
const string& http_text,
const string& from,
const string&)
303os <<
"on renaming "<< from <<
" for";
336 stringhttp_response;
342http_response = sstr.str();
381 auto& timeout(
config.comm_timeout);
403 if(bytes_read !=
NULL)
430 returnrequest.
GetFileInfo(
"on getting info for");
440 auto& timeout(
config.comm_timeout);
460 returnpath.AsString();
467 "' on locking "<< object_loc.
GetLocator());
471 "'no path in response' on locking "<< object_loc.
GetLocator());
477 returnsection.empty() ?
"filetrack": section;
497 "Decryption failed for configuration value '"+
key+
"'.", 0);
511check_locator_site(reg.GetBool(
s_GetSection(section),
"check_locator_site",
false)),
512token(reg.GetEncryptedString(
s_GetSection(section),
"token",
522 if(name ==
"ft_site") {
524}
else if(name ==
"ft_token") {
543SFileTrackConfig::SSite::operator
TValue()
Incapsulate compile time information such as __FILE__, __LINE__, NCBI_MODULE, current function.
static CJsonNode ParseJSON(const string &json, TParseFlags flags=0)
string GetString(const string &key) const
For a JSON object node, return the string referred to by the specified key.
CJsonNode GetByKeyOrNull(const string &key) const
For a JSON object node, return the value associated with the specified key.
static bool IsEncrypted(const string &data)
Check if the string contains valid encrypted data.
static string Decrypt(const string &encrypted_string)
Decrypt a string using the matching key found in the NCBI keys files.
Exception class for use by CNetStorage, CNetStorageByKey, and CNetStorageObject.
@ eNumberOfFileTrackSites
string GetLocator() const
string GetUniqueKey() const
EFileTrackSite GetFileTrackSite() const
Request context properties passed between tasks.
CTimeout â Timeout interval.
static EHTTP_HeaderParse s_HTTPParseHeader_SaveStatus(const char *, void *, int)
const unsigned kDefaultCommTimeout
#define CHECK_IO_STATUS(io, object_loc, when, already_failed)
const THTTP_Flags kDefaultHttpFlags
void s_ThrowIoStatus(const CDiagCompileInfo &info, const string object_loc, EIO_Status io_code, const string when)
CNetStorageException::EErrCode s_HttpStatusToErrCode(int http_code)
#define CHECK_HTTP_STATUS(http, object_loc,...)
const auto kUninitialized
const string s_GetDecryptedKey(const string &key)
void s_ThrowHttpStatus(const CDiagCompileInfo &info, const string object_loc, int http_code, const string &http_text, const string when)
static void s_ApplyMyNcbiId(function< void(const string &)> apply)
const STimeout s_GetDefaultTimeout(unsigned sec=kDefaultCommTimeout)
const string s_GetSection(const string §ion)
const auto kMyNcbiIdHeader
static void DLIST_NAME() append(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
unsigned int THTTP_Flags
Bitwise OR of EHTTP_Flag.
EHTTP_HeaderParse
The extended version HTTP_CreateConnectorEx() is able to track the HTTP response chain and also chang...
@ fHTTP_AutoReconnect
See HTTP_CreateConnectorEx()
@ fHTTP_SuppressMessages
Most annoying ones reduced to traces.
@ fHTTP_Flushable
Connector will really flush on Flush()
@ fHTTP_WriteThru
HTTP/1.1 writes through (chunked)
@ eHTTP_HeaderContinue
Parse succeeded, continue with body.
static const string & GetHostRole(void)
Get host role (DEV/QA/TRY/PROD) from /etc/ncbi/role.
virtual const char * GetType(void) const
Get class name as a string.
#define NCBI_RETHROW_FMT(prev_exception, exception_class, err_code, message)
The same as NCBI_RETHROW but with message processed as output to ostream.
#define NCBI_RETHROW2(prev_exception, exception_class, err_code, message, extra)
Re-throw exception with extra parameter.
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
CHttpRequest & SetTimeout(const CTimeout &timeout)
Set new timeout.
CNcbiIstream & ContentStream(void) const
Get input stream.
void SetValue(CHeaderNameConverter name, CTempString value)
Remove all existing values with the name, set the new value.
CNcbiOstream & ContentStream(void)
Get output stream to write user data.
void SetHttpFlags(THTTP_Flags flags)
Set flags passed to CConn_HttpStream.
CHttpHeaders & Headers(void)
Get HTTP headers to be sent.
CHttpRequest NewRequest(const CUrl &url, ERequestMethod method=eGet, const CHttpParam ¶m={})
Initialize request.
CHttpResponse Execute(void)
Send the request, initialize and return the response.
@ eUnknown
Unknown error.
@ eIOError
I/O error encountered while performing an op.
@ eNotExists
Illegal op applied to non-existent object.
@ eAuthError
Authentication error (e.g. no FileTrack API key)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
ERW_Result
Result codes for I/O operations.
bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)
Copy the entire contents of stream "is" to stream "os".
@ eRW_Eof
End of data, should be considered permanent.
@ eRW_Success
Everything is okay, I/O completed.
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
static string URLDecode(const CTempString str, EUrlDecode flag=eUrlDec_All)
URL-decode string.
virtual const char * GetType(void) const override
Get exception class type.
const char * IO_StatusStr(EIO_Status status)
Get the text form of an enum status value.
SConnNetInfo * ConnNetInfo_Create(const char *service)
void ConnNetInfo_Destroy(SConnNetInfo *net_info)
const TYPE & Get(const CNamedParameterList *param)
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
EVoid
To create a void (uninitialized) component instance.
Defines CRequestContext class for NCBI C++ diagnostic API.
Defines CRequestStatus class for NCBI C++ diagnostic API.
Defines NCBI C++ secure resources API.
Reader-writer based streams.
SFileTrackAPI(const SFileTrackConfig &)
CRef< SFileTrackUpload > StartUpload(const CNetStorageObjectLoc &object_loc)
shared_ptr< SConnNetInfo > m_NetInfo
CJsonNode GetFileInfo(const CNetStorageObjectLoc &object_loc)
void Remove(const CNetStorageObjectLoc &object_loc)
string GetPath(const CNetStorageObjectLoc &object_loc)
CRef< SFileTrackDownload > StartDownload(const CNetStorageObjectLoc &object_loc)
const STimeout comm_timeout
SFileTrackConfig(EVoid=eVoid)
bool ParseArg(const string &, const string &)
SFileTrackDownload(const SFileTrackConfig &config, const CNetStorageObjectLoc &object_loc)
ERW_Result Read(void *buf, size_t count, size_t *bytes_read)
CJsonNode GetFileInfo(const char *const when)
const SFileTrackConfig & m_Config
SFileTrackRequest(const SFileTrackConfig &config, const CNetStorageObjectLoc &object_loc, const string &url, SConnNetInfo *net_info=NULL, const string &user_header=kEmptyStr, THTTP_Flags flags=0)
CConn_HttpStream m_HTTPStream
const CNetStorageObjectLoc & m_ObjectLoc
void RenameFile(const string &from, const string &to)
void Write(const void *buf, size_t count, size_t *bytes_written)
SFileTrackUpload(const SFileTrackConfig &config, const CNetStorageObjectLoc &object_loc, const string &user_header, SConnNetInfo *net_info)
static string GetPath(EType type, string key)
static string GetRoot(const SFileTrackConfig &config, const CNetStorageObjectLoc &loc, const char *when)
static string Get(const SFileTrackConfig &config, const CNetStorageObjectLoc &loc, const char *when, EType type, string key)
static string Get(const SFileTrackConfig &config, const CNetStorageObjectLoc &loc, const char *when, EType type)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4