CPARK 1.0
A light-weighted, distributed computing framework for C++ that offers a fast and general-purpose large data processing solution.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
cpark::ExecutionContext Class Reference

#include <cpark.h>

Public Types

using RddId = uint32_t
 
using SplitId = uint32_t
 

Public Member Functions

 ExecutionContext ()=default
 
 ExecutionContext (Config config)
 
void setConfig (Config config)
 
const ConfiggetConfig () const noexcept
 
RddId getAndIncRddId ()
 
SplitId getAndIncSplitId ()
 
bool splitShouldCache (SplitId split_id) const noexcept
 
bool splitCached (SplitId split_id) const noexcept
 
void markDependency (SplitId from, SplitId to) noexcept
 
const std::any & getSplitCache (SplitId split_id) const
 
template<typename CacheType , typename OriginalIterator >
std::shared_future< voidstartCalculationOrGetFuture (SplitId split_id, OriginalIterator begin, OriginalIterator end)
 

Detailed Description

An execution context (or environment) for a set of cpark tasks to run. It contains the information needed to evaluate the Rdd-s and run the cpark tasks, including the id information of Rdd-s and Splits, the cache information, the thread synchronization information, and the scheduler information. Each Rdd and Split will be included in one and only one execution context.

Users should be responsible to make sure the execution context is not out-of-lifetime when executing the cpark tasks. TODO: Consider whether to use smart pointers. As a fundamental library, smart pointers might not be a good choice.

Examples
calculate_pi.cpp, collect_partitions.cpp, filter_even.cpp, merge_splits.cpp, simple.cpp, and speed_check.cpp.

Member Typedef Documentation

◆ RddId

Represents a unique id for each Rdd inside this execution context. Note that Rdd-s are copyable. Copied Rdd will have a same id.

◆ SplitId

Represents a unique id for each Split inside this execution context. Note that Splits are copyable. Copied Split will have a same id.

Constructor & Destructor Documentation

◆ ExecutionContext() [1/2]

cpark::ExecutionContext::ExecutionContext ( )
default

Creates execution context with default config.

◆ ExecutionContext() [2/2]

cpark::ExecutionContext::ExecutionContext ( Config  config)
inlineexplicit

Creates execution context from a config.

Member Function Documentation

◆ getAndIncRddId()

RddId cpark::ExecutionContext::getAndIncRddId ( )
inline

Returns the next unique Rdd id.

◆ getAndIncSplitId()

SplitId cpark::ExecutionContext::getAndIncSplitId ( )
inline

Returns the next unique Split id.

◆ getConfig()

const Config & cpark::ExecutionContext::getConfig ( ) const
inlinenoexcept

Returns the config of the execution context.

◆ getSplitCache()

const std::any & cpark::ExecutionContext::getSplitCache ( SplitId  split_id) const
inline

Returns the cache for the split, if it has already been cached.

◆ setConfig()

void cpark::ExecutionContext::setConfig ( Config  config)
inline

Sets configuration.

◆ splitCached()

bool cpark::ExecutionContext::splitCached ( SplitId  split_id) const
inlinenoexcept

Checks whether the split has already been cached.

◆ splitShouldCache()

bool cpark::ExecutionContext::splitShouldCache ( SplitId  split_id) const
inlinenoexcept

Returns whether the split should be cached.


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