Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It raises the wrangler:ruleset_uninstalled event, passing through all attributes of the original uninstall event. The KRL programmer can write a rule which selects on that event, as needed.

...

picoQuery

Wrangler provides and shares a function named skyQuery picoQuery which is a user friendly way to make an HTTP request between picos. It provides cleanup and returns the error if the returned HTTP status was not 200.It a request between picos. picoQuery uses ctx:query() if the pico is on the same host and HTTP if it is not. When using HTTP, it provides cleanup and returns the error if the returned HTTP status was not 200.

Info

The skyQuery() function in Wrangler has been deprecated. skyQuery() only did HTTP calls. Pico engine v1.X has tightened up channel policies, so that HTTP can’t be used on family channels (channels between parents and children). And making HTTP calls to picos on the same server is inefficient. Since picoQuery() and skyQuery() use the same parameters in the same order, you can like switch to using picoQuery() merely by changing the name. The skyQuery() function remains available for backward compatibility.

picoQuery() is mainly used to programmatically call functions inside of other picos from inside a rule. However, deadlocks are possible due to its synchronous nature (e.g. do not let two picos query each other simultaneously). See Accessing a Function Shared by Another Pico for more information.

...

Parameter

Datatype

Description

eci

String

The ECI to send the query to

mod

String

The RID of the ruleset to send the query to

func

String

The name of the function to query

params

Map

The parameters to be passed to the function on the target pico. Given as a map with parameter name as the key and argument as the value.

_host

String

The host of the pico engine being queried.
Note this must include protocol (http:// or https://) being used and port number if not 80.
For example "http://localhost:3000", which also is the default.

_path

String

The sub path of the url which does not include mod or func.
For example "/sky/cloud/", which also is the default.

_root_url

String

The entire URL except eci, mod , func.
For example, dependent on _host and _path is
"http://localhost:3000/sky/cloud/", which also is the default. Defaults to meta:host (the pico engine itself).

If _host is missing or the same as the result returned by meta

...

:host, picoQuery() will use ctx:query() instead of HTTP.

Returns

Success: the result of the function queried for.

Failure: a map of error information which contains the error and other optional information:

Code Block
{
    "error":"general error message",
    "skyQueryErrorpicoQueryError":"The value of the 'error key', if it exists, of the function results"
    "skyQueryErrorMsgpicoQueryErrorMsg":"The value of the 'error_str', if it exists, of the function results"
    "skyQueryReturnValuepicoQueryReturnValue":"The function call results"
}
Info

This map represents a breaking change. The previous map returned skyQueryError instead of picoQueryError, for example. If your code depends on these, you will need to update to use the new error map.

Example

Code Block
pre {
  eci = eci_to_other_pico;
  args = {"arg1": val1, "arg2": val2};
  answer = wrangler:skyQuerypicoQuery(eci,"my.ruleset.id","myFunction",{}.put(args))ƒ;
}
if answer{"error"}.isnull() then noop(); // Check that it did not return an error
fired {
  // process using answer
}

...