32 const wxString
path = wxString::FromUTF8( aPath );
38 utf8( wxString::Format(
_(
"still waiting on an earlier request for %s" ),
path ) ),
61 m_deliver = [
this]( std::vector<DB_VALUE>&& aRow )
71 m_sink( std::move( aRow ) );
91 return utf8(
_(
"the rows read from the database were not accepted" ) );
95std::string
ScrubSecret( std::string aText,
const std::string& aSecret )
97 static constexpr size_t EVERYWHERE = 4;
102 auto inWord = [](
unsigned char aChar )
104 return std::isalnum( aChar ) || aChar >= 0x80;
107 auto scrub = [&](
const std::string& aForm )
109 for(
size_t at = aText.find( aForm ); at != std::string::npos; )
111 const size_t end = at + aForm.size();
113 ( at == 0 || !inWord( aText[at - 1] ) ) && (
end >= aText.size() || !inWord( aText[
end] ) );
115 if( aForm.size() >= EVERYWHERE || alone )
117 aText.replace( at, aForm.size(),
"***" );
118 at = aText.find( aForm, at + 3 );
122 at = aText.find( aForm, at + 1 );
128 if( aSecret.find(
'"' ) != std::string::npos )
132 for(
char c : aSecret )
148std::string
RedactDetail(
const std::string& aDetail,
const std::string& aSecret )
150 static constexpr size_t SHORT_SECRET = 4;
152 if( !aSecret.empty() && aSecret.size() < SHORT_SECRET )
153 return std::string();
const DB_ROW_SINK & m_sink
DB_READ_DELIVERY(std::vector< std::string > &aLabels, const DB_ROW_SINK &aSink)
std::shared_ptr< std::vector< std::string > > m_jobLabels
std::vector< std::string > & m_labels
void Finish()
Copies the labels out if no row did, after the call returned a result.
static std::string SinkFailureMessage()
The message for a read the caller's sink gave up on.
OUTCOME
Why the last Run or RunCleanup returned without a result.
@ UNAVAILABLE
the worker thread could not start
@ REFUSED
two abandoned jobs hold the source, or no slot freed within the bound
@ TOO_LATE
a slot freed with under half the bound left, so nothing was started
std::function< void(std::vector< DB_VALUE > &&)> DB_ROW_SINK
Receives one row at a time, in the order of the labels the read produced.
@ TIMEOUT
The source did not answer within the timeout.
DB_WORKER_FAILURE DescribeWorkerOutcome(DB_WORKER_THREAD::OUTCOME aOutcome, const std::string &aPath)
Maps the outcome of a call that returned no result to a failure and a connection decision.
std::string ScrubSecret(std::string aText, const std::string &aSecret)
Replaces a secret in a message, as ***.
std::string RedactDetail(const std::string &aDetail, const std::string &aSecret)
The provider text to show for a call made with aSecret, which is nothing at all when the secret is sh...
std::string utf8(const wxString &aText)
What a backend reports, and what it does with its connection, when a worker call did not complete.
@ KEEP
Nothing ran, so the connection is intact.
@ DROP
The connection is closed through the worker.
@ FORGET
The stuck job releases the connection itself when its blocked call returns.