------------------------------------------------------------------------- RecForceInsert -------------------------------------------------------------------------
| 803 | // RecForceInsert |
| 804 | //------------------------------------------------------------------------- |
| 805 | RecRecord * |
| 806 | RecForceInsert(RecRecord *record) |
| 807 | { |
| 808 | RecRecord *r = nullptr; |
| 809 | bool r_is_a_new_record; |
| 810 | |
| 811 | ink_rwlock_wrlock(&g_records_rwlock); |
| 812 | |
| 813 | if (auto it = g_records_ht.find(record->name); it != g_records_ht.end()) { |
| 814 | r = it->second; |
| 815 | r_is_a_new_record = false; |
| 816 | rec_mutex_acquire(&(r->lock)); |
| 817 | r->rec_type = record->rec_type; |
| 818 | r->data_type = record->data_type; |
| 819 | } else { |
| 820 | r_is_a_new_record = true; |
| 821 | if ((r = RecAlloc(record->rec_type, record->name, record->data_type)) == nullptr) { |
| 822 | ink_rwlock_unlock(&g_records_rwlock); |
| 823 | return nullptr; |
| 824 | } |
| 825 | } |
| 826 | |
| 827 | // set the record value |
| 828 | RecDataSet(r->data_type, &(r->data), &(record->data)); |
| 829 | RecDataSet(r->data_type, &(r->data_default), &(record->data_default)); |
| 830 | |
| 831 | r->registered = record->registered; |
| 832 | r->rsb_id = record->rsb_id; |
| 833 | |
| 834 | if (REC_TYPE_IS_STAT(r->rec_type)) { |
| 835 | r->stat_meta.persist_type = record->stat_meta.persist_type; |
| 836 | r->stat_meta.data_raw = record->stat_meta.data_raw; |
| 837 | } else if (REC_TYPE_IS_CONFIG(r->rec_type)) { |
| 838 | r->config_meta.update_required = record->config_meta.update_required; |
| 839 | r->config_meta.update_type = record->config_meta.update_type; |
| 840 | r->config_meta.check_type = record->config_meta.check_type; |
| 841 | ats_free(r->config_meta.check_expr); |
| 842 | r->config_meta.check_expr = ats_strdup(record->config_meta.check_expr); |
| 843 | r->config_meta.access_type = record->config_meta.access_type; |
| 844 | r->config_meta.source = record->config_meta.source; |
| 845 | } |
| 846 | |
| 847 | if (r_is_a_new_record) { |
| 848 | g_records_ht.emplace(r->name, r); |
| 849 | } else { |
| 850 | rec_mutex_release(&(r->lock)); |
| 851 | } |
| 852 | |
| 853 | ink_rwlock_unlock(&g_records_rwlock); |
| 854 | |
| 855 | return r; |
| 856 | } |
| 857 | |
| 858 | //------------------------------------------------------------------------- |
| 859 | // RecDumpRecordsHt |
nothing calls this directly
no test coverage detected