1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use crate::plans::definitions::*;

#[derive(Clone, Debug)]
pub enum PredefinedTargetFunction {
    SelfIdxOffset,
}

fn get_host_at_task_idx_offset(ctx: &HostTargetEvalCtx) -> HostTarget {
    HostTarget::HostIdx(ctx.hosts[ctx.self_idx % ctx.hosts.len()] as usize)
}

pub(crate) fn compute_host_target<'a>(
    using_built_in: &PredefinedTargetFunction,
    ctx: &HostTargetEvalCtx,
) -> HostTarget {
    match using_built_in {
        PredefinedTargetFunction::SelfIdxOffset => get_host_at_task_idx_offset(ctx),
    }
}