InstanceFunctionHandler::Options

Contents

InstanceFunctionHandler::Options#

inline InstanceFunctionHandler<F, T> &YR::InstanceFunctionHandler::Options(InvokeOptions &&optsInput)#

Sets options for the function invocation, such as timeout and retry count.

This method allows you to configure specific options for the function invocation, such as setting a timeout or specifying the number of retries. These options are crucial for controlling the behavior of remote function calls. However, please note that this method does not take effect in local mode.

int main(void) {
    YR::Config conf;
    YR::Init(conf);

    YR::InvokeOptions opts;
    opts.retryTimes = 5;
    auto ins = YR::Instance(SimpleCaculator::Constructor).Invoke();
    auto r3 = ins.Function(&SimpleCaculator::Plus).Options(opts).Invoke(1, 1);

    return 0;
}

Warning

This method is designed for distributed environments and does not function in local mode. Ensure that you are using it in the appropriate context where invocation options are applicable.

Template Parameters:

Args – The types of the arguments passed to the function.

Parameters:

optsInput – The invocation options, including timeout, retry count, etc. For detailed descriptions, refer to the struct InstanceInvokeOptions.

Returns:

InstanceFunctionHandler<F, T> &, Returns a reference to the InstanceFunctionHandler object, facilitating direct invocation of the Invoke interface.