NCBI C++ ToolKit
Classes | Macros | Functions | Variables
filetrack.cpp File Reference
#include <ncbi_pch.hpp>
#include "filetrack.hpp"
#include <connect/services/ns_output_parser.hpp>
#include <connect/ncbi_http_session.hpp>
#include <util/random_gen.hpp>
#include <util/util_exception.hpp>
#include <corelib/rwstream.hpp>
#include <corelib/request_status.hpp>
#include <corelib/resource_info.hpp>
#include <corelib/request_ctx.hpp>
#include <time.h>
#include <sstream>
#include <functional>
#include <map>
#include <atomic>
+ Include dependency graph for filetrack.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  SUrl
 

Macros

#define CHECK_HTTP_STATUS(http, object_loc, ...)
 
#define CHECK_IO_STATUS(io, object_loc, when, already_failed)
 

Functions

CNetStorageException::EErrCode s_HttpStatusToErrCode (int http_code)
 
void s_ThrowHttpStatus (const CDiagCompileInfo &info, const string object_loc, int http_code, const string &http_text, const string when)
 
void s_ThrowIoStatus (const CDiagCompileInfo &info, const string object_loc, EIO_Status io_code, const string when)
 
static EHTTP_HeaderParse s_HTTPParseHeader_SaveStatus (const char *, void *, int)
 
static void s_ApplyMyNcbiId (function< void(const string &)> apply)
 
void s_ThrowHttpStatus (const CDiagCompileInfo &info, const string object_loc, int http_code, const string &http_text, const string &from, const string &)
 
const string s_GetSection (const string &section)
 
const STimeout s_GetDefaultTimeout (unsigned sec=kDefaultCommTimeout)
 
const string s_GetDecryptedKey (const string &key)
 

Variables

const THTTP_Flags kDefaultHttpFlags
 
const auto kMyNcbiIdHeader = "Delegated-From-MyNCBI-ID"
 
const auto kAuthHeader = "Authorization"
 
const auto kAuthPrefix = "Token "
 
const unsigned kDefaultCommTimeout = 30
 
const auto kUninitialized = CNetStorageObjectLoc::eNumberOfFileTrackSites
 

Macro Definition Documentation

◆ CHECK_HTTP_STATUS

#define CHECK_HTTP_STATUS (   http,
  object_loc,
  ... 
)
Value:
do { \
int http_code = http.GetStatusCode(); \
switch (http_code) { \
break; \
\
default: \
s_ThrowHttpStatus(DIAG_COMPILE_INFO, object_loc.GetLocator(), \
http_code, http.GetStatusText(), __VA_ARGS__); \
} \
} while (0)
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
Definition: ncbidiag.hpp:170
switch(yytype)
Definition: newick.tab.cpp:737

Definition at line 57 of file filetrack.cpp.

◆ CHECK_IO_STATUS

#define CHECK_IO_STATUS (   io,
  object_loc,
  when,
  already_failed 
)
Value:
do { \
EIO_Status io_code = io.Status(); \
switch (io_code) { \
case eIO_Success: \
case eIO_Closed: \
io_code = io.Status(eIO_Read); \
default: \
break; \
} \
switch (io_code) { \
case eIO_Success: \
case eIO_Closed: \
if (!already_failed) break; \
default: \
s_ThrowIoStatus(DIAG_COMPILE_INFO, object_loc.GetLocator(), \
io_code, when); \
} \
} while (0)
@ eIO_Success
everything is fine, no error occurred
Definition: ncbi_core.h:133
@ eIO_Read
read
Definition: ncbi_core.h:120

Definition at line 73 of file filetrack.cpp.

Function Documentation

◆ s_ApplyMyNcbiId()

static void s_ApplyMyNcbiId ( function< void(const string &)>  apply)
static

Definition at line 236 of file filetrack.cpp.

References Get().

Referenced by SFileTrackUpload::RenameFile(), and SFileTrackAPI::StartUpload().

◆ s_GetDecryptedKey()

const string s_GetDecryptedKey ( const string key)

◆ s_GetDefaultTimeout()

const STimeout s_GetDefaultTimeout ( unsigned  sec = kDefaultCommTimeout)

Definition at line 482 of file filetrack.cpp.

References result.

◆ s_GetSection()

const string s_GetSection ( const string section)

Definition at line 475 of file filetrack.cpp.

◆ s_HTTPParseHeader_SaveStatus()

static EHTTP_HeaderParse s_HTTPParseHeader_SaveStatus ( const char *  ,
void *  ,
int   
)
static

Definition at line 130 of file filetrack.cpp.

References eHTTP_HeaderContinue.

◆ s_HttpStatusToErrCode()

CNetStorageException::EErrCode s_HttpStatusToErrCode ( int  http_code)

◆ s_ThrowHttpStatus() [1/2]

void s_ThrowHttpStatus ( const CDiagCompileInfo info,
const string  object_loc,
int  http_code,
const string http_text,
const string from,
const string  
)

Definition at line 298 of file filetrack.cpp.

References info, and s_ThrowHttpStatus().

◆ s_ThrowHttpStatus() [2/2]

void s_ThrowHttpStatus ( const CDiagCompileInfo info,
const string  object_loc,
int  http_code,
const string http_text,
const string  when 
)

Definition at line 108 of file filetrack.cpp.

References info, and s_HttpStatusToErrCode().

Referenced by s_ThrowHttpStatus().

◆ s_ThrowIoStatus()

void s_ThrowIoStatus ( const CDiagCompileInfo info,
const string  object_loc,
EIO_Status  io_code,
const string  when 
)

Definition at line 119 of file filetrack.cpp.

References CNetStorageException::eIOError, info, and IO_StatusStr().

Variable Documentation

◆ kAuthHeader

const auto kAuthHeader = "Authorization"

◆ kAuthPrefix

const auto kAuthPrefix = "Token "

◆ kDefaultCommTimeout

const unsigned kDefaultCommTimeout = 30

Definition at line 480 of file filetrack.cpp.

◆ kDefaultHttpFlags

const THTTP_Flags kDefaultHttpFlags
Initial value:
=
@ fHTTP_AutoReconnect
See HTTP_CreateConnectorEx()
@ fHTTP_SuppressMessages
Most annoying ones reduced to traces.
@ fHTTP_Flushable
Connector will really flush on Flush()

Definition at line 136 of file filetrack.cpp.

Referenced by SFileTrackAPI::GetPath(), SFileTrackAPI::Remove(), and SFileTrackUpload::RenameFile().

◆ kMyNcbiIdHeader

const auto kMyNcbiIdHeader = "Delegated-From-MyNCBI-ID"

Definition at line 232 of file filetrack.cpp.

Referenced by SFileTrackUpload::RenameFile(), and SFileTrackAPI::StartUpload().

◆ kUninitialized

Definition at line 536 of file filetrack.cpp.

Referenced by SFileTrackConfig::SSite::operator TValue().

Modified on Fri Sep 20 14:58:21 2024 by modify_doxy.py rev. 669887