You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/administrators/policy_cookbook.md
+149Lines changed: 149 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -798,3 +798,152 @@ The implementation can be modified to apply only to specific resources, collecti
798
798
### A note about servers before 4.2.9
799
799
800
800
The 4.2.9 release of iRODS introduced dramatic changes to the way internal data transfers and data object finalization occur, and could behave differently from what is documented here. **Step 2b** should be available in servers with version 4.2.8 and older, and should behave similarly to what is documented here. A database operation similar to `data_object_finalize` which is no longer used called `mod_data_obj_meta` can also be leveraged to implement similar policy (although it uses a different, non-JSON interface).
801
+
802
+
## Retrieve information about opened replicas from `R_DATA_MAIN`
803
+
804
+
When implementing policy or a rule which deals with opened replicas, you may need more information about the opened replica from the `R_DATA_MAIN` table in the catalog such as size, host resource, or mtime.
805
+
806
+
This can be achieved by querying the iRODS Catalog using [Language-Integrated GenQuery](../../plugins/irods_rule_language/#language-integrated-general-query) or [GenQuery2 microservices](../../doxygen/msi__genquery2_8hpp.html). However, all the information in the catalog pertaining to an opened replica with a valid L1 file descriptor is already available in memory in the connected iRODS agent - all you have to do is ask.
807
+
808
+
Note: This recipe only pertains to system metadata for replica information found in`R_DATA_MAIN`. This does not give access to metadata AVUs annotated to the data object of the opened replica.
809
+
810
+
### How to do it ...
811
+
812
+
The key to accessing the in-memory information about the opened replica isin the [`msi_get_file_descriptor_info` microservice](../../doxygen/microservices_2src_2get__file__descriptor__info_8cpp.html). This microservice returns a string representing a JSONobject containing a `DataObjInfo`with information about the opened replica, and the `DataObjInp` structure which was used to open the data objectin the first place.
813
+
814
+
Here is an example of what this structure looks like:
In order to access this information via the microservice, we need a handle to a JSON structure and a JSON pointer indicating which key's value we want. For example, if we wanted to know the creation time of the replica, we would use `"/data_object_info/data_create"`.
909
+
910
+
In this example, we will implement a dynamic PEPfor the DataObjRead API, which uses an `OpenedDataObjInp` structure as part of its signature. In this PEP, we do not know the logical path of the data object which is being read and the `OpenedDataObjInp` structure does not have this information. However, it does give us access to an L1 file descriptor. Using this, we can access information about the opened replica which already resides in the iRODS agent's memory. Here is the implementation:
0 commit comments