{"_id":"illumos_contract","_rev":"64-8ba43eb7040d434036fcafd17079ccfb","name":"illumos_contract","dist-tags":{"latest":"1.0.3"},"versions":{"0.0.1":{"name":"illumos_contract","version":"0.0.1","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.0.1","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/wesolows/node-contract/issues"},"dist":{"shasum":"c3977e16ca63daf61bdd9360a6d6cd40d5389a8d","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.0.1.tgz","integrity":"sha512-YZejeeGpAMwJpjp5miLFYWYSHkA0voneR9PhISG7YeTdPhKLWcD9EmiLV1DcSRs0EssT0GwYtOzavEYTbXwF1Q==","signatures":[{"sig":"MEUCIQC9vUrj7Dc/KYkrp+LfrCLYjMLZjvYgNBQw5r7t8e4hfQIgN5jrd3NhW+8QWjkPhMfoRbiSNLl1aGZSTxlqN6J0oxM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('./lib/contract.js');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract and attempt to free all resources associated with it.\nThis is analogous to, and uses, `ct_ctl_abandon(3contract)`.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by removing all event listeners.  Similarly, a contract that has\nbeen abandoned, even if destroyed by the system, cannot be garbage collected\nby the Node.js runtime until the consumer removes all event listeners and\ndiscards all its references to that Contract object.  The effect of invoking\nmethods other than those to remove event listeners is undefined for\n`Contract` objects that have been abandoned or for which all listeners have\nbeen notified of a fatal event.  There is no explicit mechanism to discard\nthe native `ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake"},"repository":{"url":"git://github.com/wesolows/node-contract.git","type":"git"},"description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.1"},"devDependencies":{"tap":"~0.2"}},"0.0.2":{"name":"illumos_contract","version":"0.0.2","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.0.2","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/wesolows/node-contract/issues"},"os":["solaris"],"dist":{"shasum":"ace6fee01c16ca858587cde7bb8ec27dd63147d0","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.0.2.tgz","integrity":"sha512-2FTfatZtADRfcMEBCFW0H/r8HWN/+/Z9KiN/YPilUnk8R9aMEmlD7Q8yA3G3dMnu7eAl/o+crp3F2oHtOGCGkw==","signatures":[{"sig":"MEQCIBA8Phf70fvP1HUoFBHP5LcX92runhtJyX3qXlfPHTrLAiBu0OstYycj6A0ggdJ31x9PjyRRBCrgLJgrGQ0VaXrDrA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract and attempt to free all resources associated with it.\nThis is analogous to, and uses, `ct_ctl_abandon(3contract)`.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by removing all event listeners.  Similarly, a contract that has\nbeen abandoned, even if destroyed by the system, cannot be garbage collected\nby the Node.js runtime until the consumer removes all event listeners and\ndiscards all its references to that Contract object.  The effect of invoking\nmethods other than those to remove event listeners is undefined for\n`Contract` objects that have been abandoned or for which all listeners have\nbeen notified of a fatal event.  There is no explicit mechanism to discard\nthe native `ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake"},"repository":{"url":"git://github.com/wesolows/node-contract.git","type":"git"},"description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.2"},"devDependencies":{"tap":"~0.2"}},"0.0.3":{"name":"illumos_contract","version":"0.0.3","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.0.3","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/wesolows/node-contract/issues"},"os":["solaris"],"dist":{"shasum":"5575220629e791dabe5e3aa405f1eeb313ff92f4","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.0.3.tgz","integrity":"sha512-ToJT7yvFNtGQPziBSpb46fTngstHixPGbhwIrNlaLWn2sGLXgyBRCDsarhSZkm8JoilAFuuhxuBtA7Vz8gFexA==","signatures":[{"sig":"MEYCIQCtpMtDeRE8e4bQ5cgWHc0DMGBNMXhVuGXntKG023rTYQIhAMzgBWJ+Y8WT+wLyiXpBbDGqEeA3RK6NHZswjxcN/bgL","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract and attempt to free all resources associated with it.\nThis is analogous to, and uses, `ct_ctl_abandon(3contract)`.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by removing all event listeners.  Similarly, a contract that has\nbeen abandoned, even if destroyed by the system, cannot be garbage collected\nby the Node.js runtime until the consumer removes all event listeners and\ndiscards all its references to that Contract object.  The effect of invoking\nmethods other than those to remove event listeners is undefined for\n`Contract` objects that have been abandoned or for which all listeners have\nbeen notified of a fatal event.  There is no explicit mechanism to discard\nthe native `ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES})"},"repository":{"url":"git://github.com/wesolows/node-contract.git","type":"git"},"description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.2"},"devDependencies":{"tap":"~0.2"}},"0.0.4":{"name":"illumos_contract","version":"0.0.4","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.0.4","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/wesolows/node-contract/issues"},"os":["solaris"],"dist":{"shasum":"a1c320fa0689a64617be5292ea267801cba705ef","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.0.4.tgz","integrity":"sha512-lQjm0dbOVocmsBetN28erbOTxHAbZe2LOF1sFmGK859cLumlyAAgGKeCMKGiCDa8RDcEtlyYA2f50FVfP7EAOw==","signatures":[{"sig":"MEQCIA/ESolTrMYmvK/AwuuojGBmc7+R8M0m0ztgaza+5jpVAiBZb/xXZcCFwsqpqNfOj5vkKrTwLywzFxdxigWCXT5LRw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract and attempt to free all resources associated with it.\nThis is analogous to, and uses, `ct_ctl_abandon(3contract)`.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by removing all event listeners.  Similarly, a contract that has\nbeen abandoned, even if destroyed by the system, cannot be garbage collected\nby the Node.js runtime until the consumer removes all event listeners and\ndiscards all its references to that Contract object.  The effect of invoking\nmethods other than those to remove event listeners is undefined for\n`Contract` objects that have been abandoned or for which all listeners have\nbeen notified of a fatal event.  There is no explicit mechanism to discard\nthe native `ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES})"},"repository":{"url":"git://github.com/wesolows/node-contract.git","type":"git"},"description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.2"},"devDependencies":{"tap":"~0.2"}},"0.0.5":{"name":"illumos_contract","version":"0.0.5","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.0.5","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/wesolows/node-contract/issues"},"os":["solaris"],"dist":{"shasum":"07053f529596a8fd890314863405585db0bef2a4","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.0.5.tgz","integrity":"sha512-tA1wBs0OXF4oLED2Jq3LsuSgz0KYwguYXd9D0GTiXjSv8FgFHENDBdkjhBFFF+8r8KMTo05zY9TVshblVxM18w==","signatures":[{"sig":"MEYCIQCrcTXuCkD7Z2hISJuERMwz4jfw4bnLJjhqRur6aTve/gIhAOQtbTryY8JvhtJ1pWmI6bTe5qidTNMyi7bc07gHbcDH","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract and attempt to free all resources associated with it.\nThis is analogous to, and uses, `ct_ctl_abandon(3contract)`.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by removing all event listeners.  Similarly, a contract that has\nbeen abandoned, even if destroyed by the system, cannot be garbage collected\nby the Node.js runtime until the consumer removes all event listeners and\ndiscards all its references to that Contract object.  The effect of invoking\nmethods other than those to remove event listeners is undefined for\n`Contract` objects that have been abandoned or for which all listeners have\nbeen notified of a fatal event.  There is no explicit mechanism to discard\nthe native `ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES})"},"repository":{"url":"git://github.com/wesolows/node-contract.git","type":"git"},"description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.3"},"devDependencies":{"tap":"~0.2"}},"0.0.6":{"name":"illumos_contract","version":"0.0.6","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.0.6","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/wesolows/node-contract/issues"},"os":["solaris"],"dist":{"shasum":"8169e1276b31f2e68c6852da50f31edad2c402eb","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.0.6.tgz","integrity":"sha512-OSq7tzF9xrtD7IYQ/VV0MLxEDS1sLu3aBhnxjeweSugdlDpOhZEcaZ5LkasKLSWUUc7RcwQtcAYn/jdM2usuNg==","signatures":[{"sig":"MEYCIQDp4HxNZC04sVMawFv/5IupaYoGe1fg69FeQfQD5PdMLwIhAKn7HR682MMBM1uRV4XPp7OCQHuN7VyP9VP8aUhAT12M","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract and attempt to free all resources associated with it.\nThis is analogous to, and uses, `ct_ctl_abandon(3contract)`.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by removing all event listeners.  Similarly, a contract that has\nbeen abandoned, even if destroyed by the system, cannot be garbage collected\nby the Node.js runtime until the consumer removes all event listeners and\ndiscards all its references to that Contract object.  The effect of invoking\nmethods other than those to remove event listeners is undefined for\n`Contract` objects that have been abandoned or for which all listeners have\nbeen notified of a fatal event.  There is no explicit mechanism to discard\nthe native `ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES})"},"repository":{"url":"git://github.com/wesolows/node-contract.git","type":"git"},"description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.3"},"devDependencies":{"tap":"~0.2"}},"0.0.7":{"name":"illumos_contract","version":"0.0.7","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.0.7","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/wesolows/node-contract/issues"},"os":["solaris"],"dist":{"shasum":"3ab2f3f5632f495d73b351165cd89089eca55177","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.0.7.tgz","integrity":"sha512-JsSZM/x/cjUgTaABirMwkzarZMUpShZduf4xz3Q5vJDOOb2eKn3tPMGLPeH1vdji4/U5Re8x9uFiKhE5WGSC9w==","signatures":[{"sig":"MEUCIBImw8ejpKlh8hyrCsbb+mJFbPR++IuKIqmBBQaWEe0zAiEAtRIURI1oqBfZ0NXKd+MA6SlCzKQ+X2HBB6gYfFwm7tg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract and attempt to free all resources associated with it.\nThis is analogous to, and uses, `ct_ctl_abandon(3contract)`.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by removing all event listeners.  Similarly, a contract that has\nbeen abandoned, even if destroyed by the system, cannot be garbage collected\nby the Node.js runtime until the consumer removes all event listeners and\ndiscards all its references to that Contract object.  The effect of invoking\nmethods other than those to remove event listeners is undefined for\n`Contract` objects that have been abandoned or for which all listeners have\nbeen notified of a fatal event.  There is no explicit mechanism to discard\nthe native `ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES})"},"repository":{"url":"git://github.com/wesolows/node-contract.git","type":"git"},"description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.4"},"devDependencies":{"tap":"~0.2"}},"0.0.8":{"name":"illumos_contract","version":"0.0.8","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.0.8","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/wesolows/node-contract/issues"},"os":["solaris"],"dist":{"shasum":"061a1bd256402e57d16a2777d4ef3b66ad9b513c","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.0.8.tgz","integrity":"sha512-8iZVwSpMgPAmtIu398RGshi12FveHO9qnPQPB/8AQ0G3AlRM+2ZRghV9ab2r7s02YVVahynZpQFTNoAKzNyQKQ==","signatures":[{"sig":"MEYCIQCyn2tQzglN1acqfqzMIeJOL+x+jWSEMyBCTPbjZws+XQIhAKYfGfl0wtdETpu5JUwERaSe1fmyMfQegBD8OkEWsPQY","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract.  This is analogous to, and uses,\n`ct_ctl_abandon(3contract)`.  Note that although the contract is abandoned,\nresources associated with the contract object are not released, and events\nmay still be received for this contract.\n\n### Contract.dispose()\n\nFree resources associated with the contract.  When this call returns,\nall file descriptors associated with the contract will be closed, no\nfurther events will be generated on this contract, and the contract will\nbe eligible for garbage collection once it is no longer referenced by\nconsumers.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by a call to `dispose()`.  Similarly, a contract that has been\nabandoned, even if destroyed by the system, cannot be garbage collected by\nthe Node.js runtime until the consumer calls `dispose()` and discards all\nits references to that Contract object.  The effect of invoking methods\nother than those to remove event listeners is undefined for `Contract`\nobjects that have been `dispose()`d.  The effect of invoking methods other\nthan `dispose()` and those that remove event listeners is undefined for\n`Contract` objects for which all listeners have been notified of a fatal\nevent.  There is no explicit mechanism to discard the native\n`ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES})"},"repository":{"url":"git://github.com/wesolows/node-contract.git","type":"git"},"description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.4"},"devDependencies":{"tap":"~0.2"}},"0.0.9":{"name":"illumos_contract","version":"0.0.9","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.0.9","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/wesolows/node-contract/issues"},"os":["solaris","sunos"],"dist":{"shasum":"951895ede965db8ca11856ecee35e313b9c3784e","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.0.9.tgz","integrity":"sha512-XMb2gesYP9UvOEesjcgkqYgbm9oDFIwh+1RpbMQ+9Bwy0ED/5GfoinH5/aZE2zqPH+lZSt/iinV8XdbIFUdEKw==","signatures":[{"sig":"MEQCIGDPnjSV/rGAdp7VpSW2xZToGrCbYuLn0Zjk7dUyqK8VAiAP9Fk/BBsdhupkawSE5JIbm8FBIJSiOTu7nZeEoqWXZQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract.  This is analogous to, and uses,\n`ct_ctl_abandon(3contract)`.  Note that although the contract is abandoned,\nresources associated with the contract object are not released, and events\nmay still be received for this contract.\n\n### Contract.dispose()\n\nFree resources associated with the contract.  When this call returns,\nall file descriptors associated with the contract will be closed, no\nfurther events will be generated on this contract, and the contract will\nbe eligible for garbage collection once it is no longer referenced by\nconsumers.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by a call to `dispose()`.  Similarly, a contract that has been\nabandoned, even if destroyed by the system, cannot be garbage collected by\nthe Node.js runtime until the consumer calls `dispose()` and discards all\nits references to that Contract object.  The effect of invoking methods\nother than those to remove event listeners is undefined for `Contract`\nobjects that have been `dispose()`d.  The effect of invoking methods other\nthan `dispose()` and those that remove event listeners is undefined for\n`Contract` objects for which all listeners have been notified of a fatal\nevent.  There is no explicit mechanism to discard the native\n`ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES})"},"repository":{"url":"git://github.com/wesolows/node-contract.git","type":"git"},"description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.4"},"devDependencies":{"tap":"~0.2"}},"0.0.10":{"name":"illumos_contract","version":"0.0.10","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.0.10","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/wesolows/node-contract/issues"},"os":["solaris","sunos"],"dist":{"shasum":"b53914e40042ebb76d5bac14f07f35c64888e06d","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.0.10.tgz","integrity":"sha512-MVdXB7ImnFzvtWq8c0MDeMVlHcmTX5r+HFhby8wC62I99H5ki/ju1cMNqZJQCta7kuB+uXBKy0OVThLCr8KCQw==","signatures":[{"sig":"MEUCIQDkAlO8dIFo4X6o353UJ+I7egPB169LbORfXdEyiVunUAIgEJiX2Fz7c40RboeZfLlWFV8XYiMrEXJCMIBxkfIVflc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract.  This is analogous to, and uses,\n`ct_ctl_abandon(3contract)`.  Note that although the contract is abandoned,\nresources associated with the contract object are not released, and events\nmay still be received for this contract.\n\n### Contract.dispose()\n\nFree resources associated with the contract.  When this call returns,\nall file descriptors associated with the contract will be closed, no\nfurther events will be generated on this contract, and the contract will\nbe eligible for garbage collection once it is no longer referenced by\nconsumers.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by a call to `dispose()`.  Similarly, a contract that has been\nabandoned, even if destroyed by the system, cannot be garbage collected by\nthe Node.js runtime until the consumer calls `dispose()` and discards all\nits references to that Contract object.  The effect of invoking methods\nother than those to remove event listeners is undefined for `Contract`\nobjects that have been `dispose()`d.  The effect of invoking methods other\nthan `dispose()` and those that remove event listeners is undefined for\n`Contract` objects for which all listeners have been notified of a fatal\nevent.  There is no explicit mechanism to discard the native\n`ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES})"},"repository":{"url":"git://github.com/wesolows/node-contract.git","type":"git"},"description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.4"},"devDependencies":{"tap":"~0.2"}},"0.0.11":{"name":"illumos_contract","version":"0.0.11","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.0.11","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/wesolows/node-contract/issues"},"os":["solaris","sunos"],"dist":{"shasum":"0b7a3b8e21867648aeec26ff05503fa8c7c3a66c","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.0.11.tgz","integrity":"sha512-aXALO9wee6PiyvgZeTM713fsI2wE3pbZkDNUZ1FVMHYvnEbobY/d5Fd+24Mfm3dTx/mS941XiQdfKB7kN3cmYQ==","signatures":[{"sig":"MEUCIQD3zNSI+KOEusgcivEru/wkf24HcI3ipISDRKQm4nyrQQIgDCaV4oa20nQH0CQhBAud5htuGfC7NZKY+OhLw7u0gLE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract.  This is analogous to, and uses,\n`ct_ctl_abandon(3contract)`.  Note that although the contract is abandoned,\nresources associated with the contract object are not released, and events\nmay still be received for this contract.\n\n### Contract.dispose()\n\nFree resources associated with the contract.  When this call returns,\nall file descriptors associated with the contract will be closed, no\nfurther events will be generated on this contract, and the contract will\nbe eligible for garbage collection once it is no longer referenced by\nconsumers.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by a call to `dispose()`.  Similarly, a contract that has been\nabandoned, even if destroyed by the system, cannot be garbage collected by\nthe Node.js runtime until the consumer calls `dispose()` and discards all\nits references to that Contract object.  The effect of invoking methods\nother than those to remove event listeners is undefined for `Contract`\nobjects that have been `dispose()`d.  The effect of invoking methods other\nthan `dispose()` and those that remove event listeners is undefined for\n`Contract` objects for which all listeners have been notified of a fatal\nevent.  There is no explicit mechanism to discard the native\n`ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES}) binding"},"repository":{"url":"git://github.com/wesolows/node-contract.git","type":"git"},"description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.4"},"devDependencies":{"tap":"~0.2"}},"0.1.0":{"name":"illumos_contract","version":"0.1.0","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"_id":"illumos_contract@0.1.0","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"}],"bugs":{"url":"http://github.com/joyent/node-contract/issues"},"os":["solaris","sunos"],"dist":{"shasum":"2bbb2cc96142cabe2a09cc3007c6949773d8fbb0","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-0.1.0.tgz","integrity":"sha512-jn+Fup/KLZDmjBzFxoHLXONgw+BbxAc0FM3ZdHqT+NWjrsC+2CO1ERoSWMie8n8FEzY/QNcjlF5lyETD44r60A==","signatures":[{"sig":"MEUCIQCNL2tS+5q2Wz7FwbNGXwKQQ90loi7biknLyB8rA0ub1wIgKhq5qaCp+0IKh2H9Ct/sHu7aO0fYSxxhkSQSCJSTFsA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","_from":".","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract.  This is analogous to, and uses,\n`ct_ctl_abandon(3contract)`.  Note that although the contract is abandoned,\nresources associated with the contract object are not released, and events\nmay still be received for this contract.\n\n### Contract.dispose()\n\nFree resources associated with the contract.  When this call returns,\nall file descriptors associated with the contract will be closed, no\nfurther events will be generated on this contract, and the contract will\nbe eligible for garbage collection once it is no longer referenced by\nconsumers.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by a call to `dispose()`.  Similarly, a contract that has been\nabandoned, even if destroyed by the system, cannot be garbage collected by\nthe Node.js runtime until the consumer calls `dispose()` and discards all\nits references to that Contract object.  The effect of invoking methods\nother than those to remove event listeners is undefined for `Contract`\nobjects that have been `dispose()`d.  The effect of invoking methods other\nthan `dispose()` and those that remove event listeners is undefined for\n`Contract` objects for which all listeners have been notified of a fatal\nevent.  There is no explicit mechanism to discard the native\n`ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES}) binding"},"_npmUser":{"name":"wesolows","email":"keith.wesolowski@joyent.com"},"repository":{"url":"git://github.com/joyent/node-contract.git","type":"git"},"_npmVersion":"1.2.14","description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.4"},"readmeFilename":"README.md","devDependencies":{"tap":"~0.2"}},"1.0.0":{"name":"illumos_contract","version":"1.0.0","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"license":"MIT","_id":"illumos_contract@1.0.0","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"},{"name":"dap","email":"dap@cs.brown.edu"}],"bugs":{"url":"http://github.com/joyent/node-contract/issues"},"os":["solaris","sunos"],"dist":{"shasum":"bc385b5ddef6d0d855b873f8d87a55d5c180b053","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-1.0.0.tgz","integrity":"sha512-NG0kMKWRCypb1E52wWlzRoVkNw6mETDBl9l8iYyu+9kv5UXWxWoUwNw3VtLj08hE2qa+FglxiZZnGY145zVUDg==","signatures":[{"sig":"MEQCIHAikqAq89Hkl+1j+bMQk3ahKU9U8Dit9+jBeXOz2RsSAiB8rjHZgMzajuwHuPbe8dglM2GWjS3KhUX8nR1Nyt7z7A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","_from":".","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract.  This is analogous to, and uses,\n`ct_ctl_abandon(3contract)`.  Note that although the contract is abandoned,\nresources associated with the contract object are not released, and events\nmay still be received for this contract.\n\n### Contract.dispose()\n\nFree resources associated with the contract.  When this call returns,\nall file descriptors associated with the contract will be closed, no\nfurther events will be generated on this contract, and the contract will\nbe eligible for garbage collection once it is no longer referenced by\nconsumers.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by a call to `dispose()`.  Similarly, a contract that has been\nabandoned, even if destroyed by the system, cannot be garbage collected by\nthe Node.js runtime until the consumer calls `dispose()` and discards all\nits references to that Contract object.  The effect of invoking methods\nother than those to remove event listeners is undefined for `Contract`\nobjects that have been `dispose()`d.  The effect of invoking methods other\nthan `dispose()` and those that remove event listeners is undefined for\n`Contract` objects for which all listeners have been notified of a fatal\nevent.  There is no explicit mechanism to discard the native\n`ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES}) binding"},"_npmUser":{"name":"dap","email":"dap@cs.brown.edu"},"repository":{"url":"git://github.com/joyent/node-contract.git","type":"git"},"_npmVersion":"1.2.18","description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.0.4"},"readmeFilename":"README.md","devDependencies":{"tap":"~0.2"}},"1.0.1":{"name":"illumos_contract","version":"1.0.1","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"license":"MIT","_id":"illumos_contract@1.0.1","maintainers":[{"name":"wesolows","email":"keith.wesolowski@joyent.com"},{"name":"dap","email":"dap@cs.brown.edu"}],"bugs":{"url":"http://github.com/joyent/node-contract/issues"},"os":["solaris","sunos"],"dist":{"shasum":"92c9839a3a7dbfcf044b5c7ad064770132f22c24","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-1.0.1.tgz","integrity":"sha512-cjehQBv8LqhieQMNYXzSS8NgAj3N2Y45HhEXnpvaP6A7gEXeIJVpj645Utly8sgm9rzeddSCzarUKf01B7Y3LQ==","signatures":[{"sig":"MEUCIQDnUKjWAj9B+1orCiHmD2gczQmEtNDGqBl/tatLx6cu9QIgZq66Z3E9q0d2qdQxktx23Grq9evhla4GxF2ub0tj2kc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","_from":".","readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract.  This is analogous to, and uses,\n`ct_ctl_abandon(3contract)`.  Note that although the contract is abandoned,\nresources associated with the contract object are not released, and events\nmay still be received for this contract.\n\n### Contract.dispose()\n\nFree resources associated with the contract.  When this call returns,\nall file descriptors associated with the contract will be closed, no\nfurther events will be generated on this contract, and the contract will\nbe eligible for garbage collection once it is no longer referenced by\nconsumers.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by a call to `dispose()`.  Similarly, a contract that has been\nabandoned, even if destroyed by the system, cannot be garbage collected by\nthe Node.js runtime until the consumer calls `dispose()` and discards all\nits references to that Contract object.  The effect of invoking methods\nother than those to remove event listeners is undefined for `Contract`\nobjects that have been `dispose()`d.  The effect of invoking methods other\nthan `dispose()` and those that remove event listeners is undefined for\n`Contract` objects for which all listeners have been notified of a fatal\nevent.  There is no explicit mechanism to discard the native\n`ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","engines":{"node":"~0.8.1"},"scripts":{"test":"./node_modules/.bin/tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES}) binding"},"_npmUser":{"name":"wesolows","email":"keith.wesolowski@joyent.com"},"repository":{"url":"git://github.com/joyent/node-contract.git","type":"git"},"_npmVersion":"1.3.11","description":"contract(4) bindings","directories":{},"dependencies":{"v8plus":"~0.2.0"},"readmeFilename":"README.md","devDependencies":{"tap":"~0.2"}},"1.0.3":{"name":"illumos_contract","version":"1.0.3","author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"license":"MIT","_id":"illumos_contract@1.0.3","maintainers":[{"name":"todd.whiteman","email":"todd.whiteman@joyent.com"},{"name":"kusor","email":"kusorbox@gmail.com"},{"name":"wyatt","email":"wpreul@gmail.com"},{"name":"michael.hicks","email":"michael.hicks@joyent.com"},{"name":"bahamat","email":"bahamat@digitalelf.net"},{"name":"chudley","email":"aguycalledrichard@gmail.com"},{"name":"tchameroy","email":"tyler.chameroy@joyent.com"},{"name":"dbuell","email":"dayne.buell@joyent.com"},{"name":"trentm","email":"trentm@gmail.com"},{"name":"dap","email":"dap@cs.brown.edu"},{"name":"jclulow","email":"josh@sysmgr.org"},{"name":"arekinath","email":"alex@cooperi.net"},{"name":"melloc","email":"cody.mello@joyent.com"},{"name":"kellymclaughlin","email":"kelly.mclaughlin@joyent.com"}],"homepage":"https://github.com/joyent/node-contract#readme","bugs":{"url":"http://github.com/joyent/node-contract/issues"},"os":["solaris","sunos"],"dist":{"shasum":"a752c546c9fb5fb3236f725ca0ccf90d0045e77b","tarball":"https://registry.npmjs.org/illumos_contract/-/illumos_contract-1.0.3.tgz","fileCount":18,"integrity":"sha512-CZLCjStp3FAKWZIzPzJtmOPmRk+VVUfw39OLcbaQjGxt9eGNKTSix6IZaX4pjmgMiyrXb+b1rtqr/JgB+j75Aw==","signatures":[{"sig":"MEYCIQCjiKB9Kp4eAlRHuu34DqWLjCXJDdJChmTZooq0k3SbuQIhAKLE+kGWJzcX0s8oCH7d+Lhj1y8FZsFajaLwVEpuhDD4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":71966,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2uImCRA9TVsSAnZWagAAlqMQAIe71XQsm2QYG/ldj2ek\nLg0x9yR5bHRDjDJzh01fmpP13WjakhfCqYGfaIeF5XFeJZbZoCA69pYyOzyw\n/bshq6nhf13k5Mca46aC9EChDiK9Ok2iKFJh1KyT7iR3K1otSEzu2jvJEB/o\n+tapjkxkzBnDlbSj9PsqAKsLE4nL5sEAT245Dhiv2Mw8uD+hYgthFsaFZqNK\nQpxl740q6XKeRZa03MdBzDXTDMmAbVVFDFXO0dn8PhiqJKUNEBsHQebgT8JJ\nuYCkCxWCaPejzulfZ/7+L/oc2sSdKI4UfuCQbgvMCCZpvOIA1OOfdGbReI/4\ntn19qepOkxHJ/tnqjwlUxCFXmHzveLPodktayN92g+Q0FHyhsdlDZROsyP+8\n4SIc3ZubmBieJS0EmeG0dq+AeOdvp39QpvuroXQDmZHlIPPWjp9DW1m4ECzi\ncurnpjLIjDXU1Q6fEsGEvkhWkbEOcRfKSt+vcX+87osuepv4JihILR+uwUeJ\nX5iQy5iK4FFmt5GeSqBFIFaxRZ/nPxAog1eGiv9HtbqxF+RfEkh+wOBEioXJ\n7NPQUDATKXzPlGgP4DMBs5aO/LRH63US/7n7Sr1bCJS19DyzcHleNzQWrdm3\n+udyry1uukj6qcMJhbBnX+vy0I5ft0c2+UwbNCd05DsX5uZ4BgNgpdAbnFqQ\n/pxk\r\n=JKA7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","engines":{"node":"~0.8.1"},"gitHead":"10bb72075f93a439d1c7894f058198a02ac83830","scripts":{"test":"tap ./tst","postinstall":"gmake $(eval echo ${MAKE_OVERRIDES}) binding"},"_npmUser":{"name":"bahamat","email":"bahamat@digitalelf.net"},"repository":{"url":"git+https://github.com/joyent/node-contract.git","type":"git"},"_npmVersion":"6.14.13","description":"contract(4) bindings","directories":{},"_nodeVersion":"12.22.7","dependencies":{"v8plus":"~0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"tap":"~0.2"},"_npmOperationalInternal":{"tmp":"tmp/illumos_contract_1.0.3_1635889839019_0.20312330268794332","host":"s3://npm-registry-packages"}}},"time":{"created":"2012-07-12T23:21:44.469Z","modified":"2025-11-26T18:15:50.806Z","0.0.1":"2012-07-12T23:21:46.112Z","0.0.2":"2012-07-12T23:55:14.092Z","0.0.3":"2012-07-13T00:23:24.164Z","0.0.4":"2012-07-13T16:50:21.608Z","0.0.5":"2012-07-13T20:44:07.345Z","0.0.6":"2012-07-13T20:54:56.422Z","0.0.7":"2012-07-13T21:11:47.400Z","0.0.8":"2012-09-21T00:55:15.230Z","0.0.9":"2012-09-21T19:14:24.531Z","0.0.10":"2013-01-17T00:09:09.556Z","0.0.11":"2013-03-20T01:14:03.567Z","0.1.0":"2013-07-26T16:14:34.949Z","1.0.0":"2013-08-19T21:20:17.500Z","1.0.1":"2013-12-20T17:23:33.832Z","1.0.3":"2021-11-02T21:50:39.160Z"},"bugs":{"url":"http://github.com/joyent/node-contract/issues"},"author":{"name":"Keith M Wesolowski","email":"keith.wesolowski@joyent.com"},"license":"MIT","homepage":"https://github.com/joyent/node-contract#readme","repository":{"url":"git+https://github.com/joyent/node-contract.git","type":"git"},"description":"contract(4) bindings","maintainers":[{"email":"todd.whiteman@joyent.com","name":"todd.whiteman"},{"email":"kusorbox@gmail.com","name":"kusor"},{"email":"michael.hicks@joyent.com","name":"michael.hicks"},{"email":"bahamat@digitalelf.net","name":"bahamat"},{"email":"Tr@visPaul.me","name":"tpaul"},{"email":"danmcd@edgecast.io","name":"kebesays"},{"email":"trentm@gmail.com","name":"trentm"},{"email":"dap@cs.brown.edu","name":"dap"},{"email":"josh@sysmgr.org","name":"jclulow"},{"email":"alex@cooperi.net","name":"arekinath"},{"email":"melloc@writev.io","name":"melloc"},{"email":"kelly.mclaughlin@joyent.com","name":"kellymclaughlin"}],"readme":"# node-contract\n\nThis addon provides a Node.js interface to the SunOS contract(4) subsystem.\nThis documentation assumes that you are familiar with the contract(4),\nprocess(4), and device_contract(4) documentation.\n\n## Quick Start\n\n\tvar contract = require('illumos_contract');\n\tvar util = require('util');\n\tvar child_process = require('child_process');\n\n\tvar ct;\n\tvar child;\n\tvar tmpl = {\n\t\ttype: 'process',\n\t\tcritical: {\n\t\t\tpr_empty: true,\n\t\t\tpr_hwerr: true\n\t\t},\n\t\tinformative: {\n\t\t\tpr_exit: true,\n\t\t\tpr_core: true\n\t\t},\n\t\tparam: {\n\t\t\tnoorphan: true\n\t\t},\n\t\tcookie: '0xdeadbeef`\n\t};\n\n\tcontract.set_template(tmpl);\n\tchild = child_process.spawn('/usr/sbin/rpcbind');\n\tcontract.clear_template();\n\tct = contract.latest();\n\tconsole.log(util.inspect(ct.status(), null, true));\n\n\tct.on('pr_empty', function (ev) {\n\t\tconsole.log(util.inspect(ev, null, true));\n\t\tconsole.log('contract ' + ev.ctid + ' has emptied');\n\t\tconsole.log(util.inspect(ct.status(), null, true));\n\n\t\tct.abandon();\n\t\tct.removeAllListeners();\n\t\tct = null;\n\t});\n\n## Creating Contracts\n\nThere are 4 ways to create a new contract visible to your process:\n\n- adopt an existing contract\n- observe an existing contract without adopting it\n- fetch the latest contract created by a fork(2) or open(2)\n- explicitly create a device contract\n\nThe latter two mechanisms require that a template be active.\n\nThe public interfaces for performing these actions are as follows:\n\n### contract.adopt([Number] ctid)\n\nAdopt the specified contract, as for `ct_ctl_adopt(3contract)`.\n\n### contract.observe([Number] ctid)\n\nObserve, without adopting, the specified contract.  This is analogous to\nopening only the event descriptor associated with the contract and watching\nit for events as via `ctwatch(1)`.  Contracts created in this manner cannot\nbe subsequently adopted, abandoned, or otherwise modified.\n\n### contract.set_template([Object] template)\n\nCreate and activate a template with the specified attributed.  The template\nobject's properties correspond to those that may be set by `ct_tmpl_set_*`,\nincluding those properties specific to the contract type.  The `type` field,\nwhich is not such an attribute, is required and must be one of `process` or\n`device`.  The template provided completely replaces any existing active\ntemplate of the same type.\n\n### contract.create() [ or open, fork, etc. ]\n\n`contract.create()` is analogous to and uses `ct_tmpl_create(3contract)`.\nFollowing such a contract creation, the contract created may be accessed via\na call to `contract.latest()`.  Note that this function is useful only for\ndevice contracts.  One may also create device contracts by setting a\ntemplate, then opening a device minor node.  Process contracts can be\ncreated only by setting a template, then performing a `fork(2)` such as via\n`child_process` functionality.\n\n### contract.latest()\n\nReturns an object of type `Contract` with methods described below.  The\ncontract returned represents the most recently created contract.  Note that\nif you set a template, perform an action that instantiates a contract, then\nset another template and perform another contract-instantiating action\nprior to calling `contract.latest()`, the first contract created cannot be\nretrieved unless its ctid becomes known through some alternate mechanism.\nIt is also likely that such a calling sequence will result in resource\nleaks.\n\n### contract.clear_template()\n\nRemove any active contract templates.  Following this call, actions that\nwould instantiate a new contract or add members to an existing contract will\ninstead behave normally.\n\n## Contract\n\nThe `observe()`, `adopt()`, and `latest()` methods return an object of type\nContract, with the following methods:\n\n### Contract.status()\n\nReturns an object with fields corresponding to the attributes accessible via\na `ct_stathdl_t` from `ct_status_read(3contract)`, including those which are\nspecific to the contract type.  Flags fields are represented as embedded\nobjects with one boolean property per flag.\n\n### Contract.abandon()\n\nAbandon the contract.  This is analogous to, and uses,\n`ct_ctl_abandon(3contract)`.  Note that although the contract is abandoned,\nresources associated with the contract object are not released, and events\nmay still be received for this contract.\n\n### Contract.dispose()\n\nFree resources associated with the contract.  When this call returns,\nall file descriptors associated with the contract will be closed, no\nfurther events will be generated on this contract, and the contract will\nbe eligible for garbage collection once it is no longer referenced by\nconsumers.\n\n### Contract.ack([String] evid)\n\nSee `ct_ctl_ack(3contract)`.\n\n### Contract.nack([String] evid)\n\nSee `ct_ctl_nack(3contract)`.\n\n### Contract.qack([String] evid)\n\nSee `ct_ctl_qack(3contract)`.\n\n## Contract Events\n\nContract objects inherit from Node.js's `events.EventEmitter`; they emit\nevents whenever the underlying contract generates an informative, critical,\nor fatal event.  Within the event callback, critical and fatal events must\nbe acknowledged.  The event names correspond to those specified by\n`contract(4)`, `process(4)`, and `device_contract(4)`, lower-cased with\n`CT_` and `EV_` removed; e.g., `pr_empty`.  These event names are also used\nwhen passing event sets within template and status objects.\n\n## Destruction of Contracts\n\nA contract that has been broken, whether as part of a negotiated transition\nor because of a fatal asynchronous event, becomes invalid.  It is the\nresponsibility of the listener(s) to ensure that it can subsequently be\ncleaned up by a call to `dispose()`.  Similarly, a contract that has been\nabandoned, even if destroyed by the system, cannot be garbage collected by\nthe Node.js runtime until the consumer calls `dispose()` and discards all\nits references to that Contract object.  The effect of invoking methods\nother than those to remove event listeners is undefined for `Contract`\nobjects that have been `dispose()`d.  The effect of invoking methods other\nthan `dispose()` and those that remove event listeners is undefined for\n`Contract` objects for which all listeners have been notified of a fatal\nevent.  There is no explicit mechanism to discard the native\n`ContractBinding` object itself.\n\n## Implementation Notes\n\nContract creation is done via the `contract_binding._new()` mechanism, as\nfollows:\n\n- `contract_binding._new(<ctid>)` observes an existing contract.\n- `contract_binding._new(<ctid>, true)` adopts an existing contract.\n- `contract_binding._new()` returns the last contract created.\n\n`contract_binding._create()` explicitly creates a device contract from the\nactive template but does not return it; use `contract_binding._new()`\nafterward to obtain the newly-created contract.\n\n`contract_binding._new()` returns a native object of type `ContractBinding`.\nThis native object, and any other properties of `contract` or `Contract`\nwhose keys begin with the underscore (`_`) character, should not be read,\nreplaced, removed, or modified by consumers.\n\nNote that there is currently no support for writing a new contract to\nreplace one that has been broken via negotiation or an asynchronous device\nstate change (analogous to `ct_ctl_newct(3contract)`).  Otherwise it should\nbe possible to access all public functionality of the contract subsystem for\nboth device and process contracts.\n\n## License\n\nMIT.\n","readmeFilename":"README.md"}