KiCad PCB EDA Suite
Loading...
Searching...
No Matches
db_backend_support.h File Reference
#include <chrono>
#include <functional>
#include <future>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <thread>
#include <vector>
#include <wx/string.h>
#include <database/database_backend.h>
#include "db_worker_thread.h"

Go to the source code of this file.

Classes

struct  DB_WORKER_FAILURE
 What a backend reports, and what it does with its connection, when a worker call did not complete. More...
 
class  DB_READ_DELIVERY
 Hands rows from a worker job to a caller's sink and gives the caller the column labels. More...
 
class  DB_PROBE_LATCH< T >
 Runs a slow probe once on a thread of its own and keeps its answer for good. More...
 

Functions

std::string utf8 (const wxString &aText)
 
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 short.
 

Function Documentation

◆ DescribeWorkerOutcome()

DB_WORKER_FAILURE DescribeWorkerOutcome ( DB_WORKER_THREAD::OUTCOME aOutcome,
const std::string & aPath )

◆ RedactDetail()

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 short.

Definition at line 148 of file db_backend_support.cpp.

References ScrubSecret().

Referenced by describeFailure().

◆ ScrubSecret()

std::string ScrubSecret ( std::string aText,
const std::string & aSecret )

Replaces a secret in a message, as ***.

The doubled-quote form that an initialization string holds for a secret containing a quote goes too.

A secret of four or more characters goes wherever it occurs. A shorter one goes only where it stands apart from letters, digits and non-ASCII bytes, since replacing a one-character secret inside words would leave the message unreadable. That leaves a short secret hiding inside a longer word, so provider text that may echo a short secret must go through RedactDetail instead.

Definition at line 95 of file db_backend_support.cpp.

References end.

Referenced by ACE_BACKEND::fail(), and RedactDetail().

◆ utf8()