Nature 所提供的接口都是基于 http 请求的。
这是外系统输入信息到 Nature 的主要方法。
入参为 Instance ,请见数据定义里的 Instance。如果调用者没有给出 Instance.id且未指定 Instance.para 则 Nature 会为其分配一个 id。
出参为 Instance.id,类型为 Result。其 json 示例如下
{"Ok":12345}callback 用于 Executor 的 convert 接口和 Nature 进行异步通讯。异步方式下convert须立即返回数据定义里的ConverterReturned::Delay(seconds),以告诉 Nature 结果将在Delay所给定的时间内返回,当真正完成任务后 convert 通过调用 Nature 的 callback 接口将结果推送给 Nature。如果没有在Delay时间内提交结果 Nature 会依据重试策略进行重试。
入参请参考数据定义里的 DelayedInstances,出参为 Result<()>,其 json 形式如下:
{"Ok":null}用于查询给定 Meta 和 id 的 instance 。
入参请参考数据定义的 KeyCondition, 出参为 Result<Option>,对应的 json形式如下:
存在
{"Ok":{}} // {} 为 instance, 请参考数据定义中的 instance不存在
{"Ok":null}用于查询批量的 instance。
入参请参考数据定义的 KeyCondition, 出参为 Result<Vec>,对应的 json形式如下:
{"Ok":[]} // [] 为 instance 数组, 请参考数据定义中的 instance这个接口为 Nature 系统内部的接口,只需了解一下就可以了,您并不会直接使用这个接口。此接口用于重试失败的任务,由 retry 可执行程序进行调用。