{"id":20358179,"url":"https://github.com/irods/irods_rule_engine_plugin_hard_links","last_synced_at":"2025-04-12T03:15:21.479Z","repository":{"id":41849614,"uuid":"241777205","full_name":"irods/irods_rule_engine_plugin_hard_links","owner":"irods","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-02T16:28:54.000Z","size":86,"stargazers_count":0,"open_issues_count":3,"forks_count":5,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-12T03:15:17.618Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/irods.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-20T02:43:21.000Z","updated_at":"2021-12-22T00:50:49.000Z","dependencies_parsed_at":"2023-01-22T13:30:19.464Z","dependency_job_id":null,"html_url":"https://github.com/irods/irods_rule_engine_plugin_hard_links","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irods%2Firods_rule_engine_plugin_hard_links","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irods%2Firods_rule_engine_plugin_hard_links/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irods%2Firods_rule_engine_plugin_hard_links/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irods%2Firods_rule_engine_plugin_hard_links/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irods","download_url":"https://codeload.github.com/irods/irods_rule_engine_plugin_hard_links/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248510001,"owners_count":21116130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T23:25:42.739Z","updated_at":"2025-04-12T03:15:21.461Z","avatar_url":"https://github.com/irods.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iRODS Rule Engine Plugin - Hard Links\n\nAdds hard link support to iRODS.\n\n## Requirements\n- iRODS v4.3.0+\n- irods-dev package\n- irods-externals-boost package\n- irods-externals-fmt package\n- irods-externals-json package\n- irods-externals-spdlog package\n- irods-runtime package\n\n## Compiling\n```bash\n$ git clone https://github.com/irods/irods_rule_engine_plugin_hard_links\n$ mkdir _build\n$ cd _build\n$ cmake -GNinja ../irods_rule_engine_plugin_hard_links\n$ ninja package\n```\nAfter compiling, you should now have a `deb` or `rpm` package with a name similar to the following:\n```bash\nirods-rule-engine-plugin-hard-links-\u003cplugin_version\u003e-\u003cos\u003e-\u003carch\u003e.\u003cdeb|rpm\u003e\n```\n\n## Installing\nUbuntu:\n```bash\n$ sudo dpkg -i irods-rule-engine-plugin-hard-links-*.deb\n```\nCentOS:\n```bash\n$ su -c yum localinstall irods-rule-engine-plugin-hard-links-*.rpm\n```\nIf the installation was successful, you should now have a new shared library. The full path to the library\nshould be similar to the following:\n```\n\u003cirods_lib_home\u003e/plugins/rule_engines/libirods_rule_engine_plugin-hard_links.so\n```\n\n## Configuration\nTo enable, prepend the following plugin config to the list of rule engines in `/etc/irods/server_config.json`. \nThe plugin config must be placed ahead of all plugins that do not support continuation.\n\nEven though this plugin will process PEPs first due to it's positioning, subsequent Rule Engine Plugins (REP) will \nstill be allowed to process the same PEPs without any issues.\n```javascript\n\"rule_engines\": [\n    {\n        \"instance_name\": \"irods_rule_engine_plugin-hard_links-instance\",\n        \"plugin_name\": \"irods_rule_engine_plugin-hard_links\",\n        \"plugin_specific_configuration\": {}\n    },\n    \n    // ... Previously installed rule engine plugin configs ...\n]\n```\n\n## How to Use\nThe following operations are supported:\n- hard_links_create\n- hard_link_create (alias of hard_links_create)\n\n### Invoking operations via the Plugin\nTo invoke an operation through the plugin, JSON must be passed using the following structure:\n```javascript\n{\n    // One of the operations listed above.\n    // Because there is only one operation at this time, this should\n    // be set to \"hard_link_create\".\n    \"operation\": \"\u003cvalue\u003e\",\n\n    // The absolute path of the source data object.\n    \"logical_path\": \"\u003cvalue\u003e\",\n\n    // The replica number identifying a specific replica under the\n    // source data object.\n    \"replica_number\": \"\u003cvalue\u003e\",\n\n    // The absolute logical path to use for the new hard linked data object.\n    // This path will point to the physical path identified by\n    // tuple (logical_path, replica_number).\n    \"link_name\": \"\u003cvalue\u003e\"\n}\n```\n#### Creating a hard link\nUse `irule` to execute the operation. For example, given the following:\n```bash\n$ ils -L\n/tempZone/home/rods:\n  rods              0 demoResc          507 2020-04-07.07:47 \u0026 foo\n        generic    /var/lib/irods/Vault/home/rods/foo\n```\n\nWe can create a hard link by running the following:\n```bash\n$ irule -r irods_rule_engine_plugin-hard_links-instance '{\"operation\": \"hard_link_create\", \"logical_path\": \"/tempZone/home/rods/foo\", \"replica_number\": \"0\", \"link_name\": \"/tempZone/home/rods/bar.hl\"}' null ruleExecOut\n```\n\nIf there were no errors, then `ils -L` will produce the following output:\n```bash\n$ ils -L\n/tempZone/home/rods:\n  rods              0 demoResc          507 2020-04-07.07:47 \u0026 foo\n        generic    /var/lib/irods/Vault/home/rods/foo\n  rods              0 demoResc          507 2020-04-07.08:10 \u0026 bar.hl\n        generic    /var/lib/irods/Vault/home/rods/foo\n```\nNotice how both data objects have a replica number of zero. Hard links are created as if the source data\nobject does not exist in iRODS. \n\nWe can verify that these two data objects are hard linked to the same physical object by showing that they\nhave identical hard link metadata values. Here, `value` is simply a unique identifier and `units` is the\nID of the resource where the physical object rests. Notice how `value` and `units` are the same for both\ndata objects. All data objects sharing the same `(value, units)` pair point to the same physical object.\n```bash\n$ imeta ls -d foo\nAVUs defined for dataObj /tempZone/home/rods/foo:\nattribute: irods::hard_link\nvalue: 63fa4580-d98e-4dec-b27b-6a4157551ebc\nunits: 10014\n$ imeta ls -d bar.hl\nAVUs defined for dataObj /tempZone/home/rods/bar.hl:\nattribute: irods::hard_link\nvalue: 63fa4580-d98e-4dec-b27b-6a4157551ebc\nunits: 10014\n```\n\n#### Removing a hard link\nThe plugin understands `irm` and `itrim`, so you are free to remove hard links with them. If there are\nat least two data objects sharing the same hard link metadata, then attempting to remove one of them\ntriggers an unregister of that data object. The hard link metadata is removed from all data objects when\nthere are only two left.\n\n### Invoking operations via the Native Rule Language\nThe following creates a hard link just like in the section above.\n```bash\n$ irule -r irods_rule_engine_plugin-irods_rule_language-instance 'hard_link_create(*lp, *rn, *ln)' '*lp=/tempZone/home/rods/foo%*rn=0%*ln=/tempZone/home/rods/bar.hl' ruleExecOut\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firods%2Firods_rule_engine_plugin_hard_links","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firods%2Firods_rule_engine_plugin_hard_links","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firods%2Firods_rule_engine_plugin_hard_links/lists"}