...
Create well known Rx rule selects on ruleset_added event where rids matches its own ruleset rid. Checks for a well known channel, and creates it if one does not exist. Then raises an event detailing the creation. This rule guarantees a well known channel exist, which is a dependency of subscriptions.
Warning: Deprecated, Untested Example of prototypes
Picos can be created using prototypes that describe what state a pico should be created in.
Picos can have certain rulesets, channels, and subscriptions that control what a pico is, Prototypes directly reflect this.
here is an example of a Prototype.
Code Block | ||
---|---|---|
| ||
{
"meta" : {
"discription": "picoLabExample prototype"
},
"rids": [
"b16x29.prod",
"b507901x6.prod"
],
"channels" : [{
"name" : "_wellKnown_app_eci",
"type" : "WellKnown",
"attributes" : "none",
"policy" : "not implemented"
}
],
"prototypes" : [],
"subscriptions_request": [],
"Prototype_events" : [],
"PDS" : {
"profile" : {
"name":"base",
"description":"discription of the general pds created",
"location":"40.252683,-111.657486",
"model":"unknown",
"model_description":"no model at this time",
"photo":""
},
"general" : {"test":{"subtest":"just a test"}},
"settings": {"b507901x1.prod":{
"name":"wrangler",
"keyed_rid" :"b507901x1.prod",
"schema":["im","a","schema"],
"data_key":"first_key",
"value":"first_value"
}
}
}
} |
Prototypes are json objects which have desired things to be added at creation.
Before a child_creation event you can add a prototype by url, and have wrangler use this prototype to create the pico accordingly.
Overview
...
Creating a Pico
...
Deleting a Pico
...
Managing Code Startup on Pico Creation
...
Managing Code Cleanup on Pico Deletion
...
Understanding the Lifecycle
...
Prototypes
...
Code Block | ||
---|---|---|
| ||
rule createPicoWithPrototypeURL { select when owner need_new_pico pre {} /*action*/{ noop();} always { raise wrangler event "add_prototype" with prototype_name = 'NewPrototypeExample' and url = 'https://raw.githubusercontent.com/burdettadam/Practice-with-KRL/master/manifold/NewPrototypeExample.json';// ----------------------------------------------needs url to prototype. --------------------------------------------------------- raise wrangler event "child_creation" with name = 'PrototypeExample' and prototype = 'NewPrototypeExample'; // must be the same name you used above log("SUCCESS OFTEN COMES AFTER DISAPPOINTMENTS.");// just a friendly log. } } |
...