Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of the RGW Usage class

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report