Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the use of the RGW Usage class

Shulou Source: shulou.com Published: 2022-05-31 18:13:14 09月26日 Update

Editor to share with you what is the use of the RGW Usage class, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

First, an overview.

The RGW Usage class implements the traffic statistics function of RGW, including the number of bytes sent / received, the number of operations performed, and the number of successful rows. These contents of Usage class statistics are sufficient for general traffic statistics.

Second, the analysis of core data structure.

The core data structure of RGW Usage is as follows:

Struct rgw_usage_log_entry {

Rgw_user owner

Rgw_user payer

String bucket

Uint64_t epoch

Rgw_usage_data total_usage

Map usage_map

}

Third, the core class diagram.

Fourth, the core processing function parsing.

1. Get RGWUsage information.

RGWUsage::show ()

| | _ RGWRados::read_usage () |

| | _ RGWRados::cls_obj_usage_log_read () |

| | _ cls_rgw_usage_log_read () |

| | _ rgw_user_usage_log_read () |

| | _ usage_iterate_range () |

| | _ cls_cxx_map_get_vals () CEPH_OSD_OP_OMAPGETVALS |

| | _ _ usage_record_decode () parses the rgw_usage_log_entry object from bufferlist |

| | _ usage_log_read_cb () |

| | _ _ create a rgw_user_bucket object through rgw_usage_log_entry::owner and rgw_usage_log_entry::bucket |

| | _ _ write to map with rgw_user_bucket object as key,rgw_usage_log_entry as value |

2. Delete RGWUsage information.

RGWUsage::trim ()

| | _ RGWRados::trim_usage () |

| | _ RGWRados::cls_obj_usage_log_trim () |

| | _ cls_rgw_usage_log_trim () |

| | _ rgw_user_usage_log_trim () |

| | _ usage_iterate_range () |

| | _ cls_cxx_map_get_vals () CEPH_OSD_OP_OMAPGETVALS |

| | _ _ usage_record_decode () parses the rgw_usage_log_entry object from bufferlist |

| | _ usage_log_trim_cb () |

| | _ usage_record_name_by_time () format: epoch_user_bucket |

| | _ usage_record_name_by_user () format: user_epoch_bucket |

| | _ cls_cxx_map_remove_key () CEPH_OSD_OP_OMAPRMKEYS |

| | _ cls_cxx_map_remove_key () CEPH_OSD_OP_OMAPRMKEYS |

3. Add RGWUsage information.

You can add RGWUsage information through the flush () function or through the rgw_log_op () function. The entry code for adding RGWUsage information is located in RGWRados::log_usage (). The processing flow of this function is described in detail below.

RGWRados::log_usage ()

| | _ RGWRados::cls_obj_usage_log_add () |

| | _ cls_rgw_usage_log_add () |

| | _ rgw_user_usage_log_add () |

| | _ usage_record_name_by_time () format: epoch_user_bucket |

| | _ cls_cxx_map_set_val () CEPH_OSD_OP_OMAPSETVALS |

| | _ usage_record_name_by_user () format: user_epoch_bucket |

| | _ cls_cxx_map_set_val () CEPH_OSD_OP_OMAPSETVALS |

The above is all the content of this article "what is the use of RGW Usage classes?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Information function object core format content article statistics number data structure traffic structure processing success not much code entry including functions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Technology Linux macOS Huawei