Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::AsyncResult Class Reference
Collaboration diagram for duckdb::AsyncResult:

Public Member Functions

 AsyncResult (AsyncResult &&)=default
 AsyncResult (SourceResultType t)
 AsyncResult (vector< unique_ptr< AsyncTask > > &&task)
AsyncResult & operator= (SourceResultType t)
AsyncResult & operator= (AsyncResultType t)
AsyncResult & operator= (AsyncResult &&) noexcept
void ScheduleTasks (InterruptState &interrupt_state, Executor &executor)
void ExecuteTasksSynchronously ()
bool HasTasks () const
AsyncResultType GetResultType () const
vector< unique_ptr< AsyncTask > > && ExtractAsyncTasks ()

Static Public Member Functions

static AsyncResultType GetAsyncResultType (SourceResultType s)
static AsyncResultsExecutionMode ConvertToAsyncResultExecutionMode (const PhysicalTableScanExecutionStrategy &execution_mode)

Private Member Functions

 AsyncResult (AsyncResultType t)

Private Attributes

AsyncResultType result_type {AsyncResultType::INVALID}
vector< unique_ptr< AsyncTask > > async_tasks {}

Constructor & Destructor Documentation

◆ AsyncResult() [1/3]

duckdb::AsyncResult::AsyncResult ( AsyncResultType t)
explicitprivate
327846 : result_type(t) {
327847 if (result_type == AsyncResultType::BLOCKED) {
327848 throw InternalException("AsyncResult constructed with a BLOCKED state, do provide AsyncTasks");
327849 }
327850}

◆ AsyncResult() [2/3]

duckdb::AsyncResult::AsyncResult ( SourceResultType t)
327843 : AsyncResult(GetAsyncResultType(t)) {
327844}

◆ AsyncResult() [3/3]

duckdb::AsyncResult::AsyncResult ( vector< unique_ptr< AsyncTask > > && task)
explicit
327853 : result_type(AsyncResultType::BLOCKED), async_tasks(std::move(tasks)) {
327854 if (async_tasks.empty()) {
327855 throw InternalException("AsyncResult constructed from empty vector of tasks");
327856 }
327857}

Member Function Documentation

◆ operator=() [1/3]

AsyncResult & duckdb::AsyncResult::operator= ( duckdb::SourceResultType t)
327859 {
327860 result_type = GetAsyncResultType(t);
327861 async_tasks.clear();
327862 return *this;
327863}

◆ operator=() [2/3]

AsyncResult & duckdb::AsyncResult::operator= ( duckdb::AsyncResultType t)
327865 {
327866 result_type = t;
327867 async_tasks.clear();
327868 return *this;
327869}

◆ operator=() [3/3]

AsyncResult & duckdb::AsyncResult::operator= ( AsyncResult && other)
noexcept
327871 {
327872 result_type = other.result_type;
327873 async_tasks = std::move(other.async_tasks);
327874 return *this;
327875}

◆ ScheduleTasks()

void duckdb::AsyncResult::ScheduleTasks ( InterruptState & interrupt_state,
Executor & executor )
327877 {
327878 if (result_type != AsyncResultType::BLOCKED) {
327879 throw InternalException("AsyncResult::ScheduleTasks called on non BLOCKED AsyncResult");
327880 }
327881
327882 if (async_tasks.empty()) {
327883 throw InternalException("AsyncResult::ScheduleTasks called with no available tasks");
327884 }
327885
327886 shared_ptr<Counter> counter = make_shared_ptr<Counter>(async_tasks.size());
327887
327888 for (auto &async_task : async_tasks) {
327889 auto task = make_uniq<AsyncExecutionTask>(executor, std::move(async_task), interrupt_state, counter);
327890 TaskScheduler::GetScheduler(executor.context).ScheduleTask(executor.GetToken(), std::move(task));
327891 }
327892}

◆ ExecuteTasksSynchronously()

void duckdb::AsyncResult::ExecuteTasksSynchronously ( )
327894 {
327895 if (result_type != AsyncResultType::BLOCKED) {
327896 throw InternalException("AsyncResult::ExecuteTasksSynchronously called on non BLOCKED AsyncResult");
327897 }
327898
327899 if (async_tasks.empty()) {
327900 throw InternalException("AsyncResult::ExecuteTasksSynchronously called with no available tasks");
327901 }
327902
327903 for (auto &async_task : async_tasks) {
327904 async_task->Execute();
327905 }
327906
327907 async_tasks.clear();
327908
327909 result_type = AsyncResultType::HAVE_MORE_OUTPUT;
327910}

◆ GetAsyncResultType()

AsyncResultType duckdb::AsyncResult::GetAsyncResultType ( SourceResultType s)
static
327912 {
327913 switch (s) {
327914 case SourceResultType::HAVE_MORE_OUTPUT:
327915 return AsyncResultType::HAVE_MORE_OUTPUT;
327916 case SourceResultType::FINISHED:
327917 return AsyncResultType::FINISHED;
327918 case SourceResultType::BLOCKED:
327919 return AsyncResultType::BLOCKED;
327920 }
327921 throw InternalException("GetAsyncResultType has an unexpected input");
327922}

◆ HasTasks()

bool duckdb::AsyncResult::HasTasks ( ) const
327924 {
327925 D_ASSERT(result_type != AsyncResultType::INVALID);
327926 if (async_tasks.empty()) {
327927 D_ASSERT(result_type != AsyncResultType::BLOCKED);
327928 return false;
327929 } else {
327930 D_ASSERT(result_type == AsyncResultType::BLOCKED);
327931 return true;
327932 }
327933}

◆ GetResultType()

AsyncResultType duckdb::AsyncResult::GetResultType ( ) const
327934 {
327935 D_ASSERT(result_type != AsyncResultType::INVALID);
327936 if (async_tasks.empty()) {
327937 D_ASSERT(result_type != AsyncResultType::BLOCKED);
327938 } else {
327939 D_ASSERT(result_type == AsyncResultType::BLOCKED);
327940 }
327941 return result_type;
327942}

◆ ExtractAsyncTasks()

vector< unique_ptr< AsyncTask > > && duckdb::AsyncResult::ExtractAsyncTasks ( )
327943 {
327944 D_ASSERT(result_type != AsyncResultType::INVALID);
327945 result_type = AsyncResultType::INVALID;
327946 return std::move(async_tasks);
327947}

◆ ConvertToAsyncResultExecutionMode()

AsyncResultsExecutionMode duckdb::AsyncResult::ConvertToAsyncResultExecutionMode ( const PhysicalTableScanExecutionStrategy & execution_mode)
static
327975 {
327976 switch (execution_mode) {
327977 case PhysicalTableScanExecutionStrategy::DEFAULT:
327978 case PhysicalTableScanExecutionStrategy::TASK_EXECUTOR:
327979 case PhysicalTableScanExecutionStrategy::TASK_EXECUTOR_BUT_FORCE_SYNC_CHECKS:
327980 return AsyncResultsExecutionMode::TASK_EXECUTOR;
327981 case PhysicalTableScanExecutionStrategy::SYNCHRONOUS:
327982 return AsyncResultsExecutionMode::SYNCHRONOUS;
327983 }
327984 throw InternalException("ConvertToAsyncResultExecutionMode passed an unexpected execution_mode");
327985}

Member Data Documentation

◆ result_type

AsyncResultType duckdb::AsyncResult::result_type {AsyncResultType::INVALID}
private
26099{AsyncResultType::INVALID};

◆ async_tasks

vector<unique_ptr<AsyncTask> > duckdb::AsyncResult::async_tasks {}
private
26100{};

The documentation for this class was generated from the following files: