metrics_store.h (1454B)
1 /* Copyright (c) 2020-2021, The Tor Project, Inc. */ 2 /* See LICENSE for licensing information */ 3 4 /** 5 * @file metrics_store.h 6 * @brief Header for lib/metrics/metrics_store.c 7 **/ 8 9 #ifndef TOR_LIB_METRICS_METRICS_STORE_H 10 #define TOR_LIB_METRICS_METRICS_STORE_H 11 12 #include "lib/buf/buffers.h" 13 #include "lib/container/smartlist.h" 14 15 #include "lib/metrics/metrics_common.h" 16 #include "lib/metrics/metrics_store_entry.h" 17 18 /* Stub. */ 19 typedef struct metrics_store_t metrics_store_t; 20 21 /* Allocators. */ 22 void metrics_store_free_(metrics_store_t *store); 23 #define metrics_store_free(store) \ 24 FREE_AND_NULL(metrics_store_t, metrics_store_free_, (store)) 25 metrics_store_t *metrics_store_new(void); 26 27 /* Modifiers. */ 28 metrics_store_entry_t *metrics_store_add(metrics_store_t *store, 29 metrics_type_t type, const char *name, 30 const char *help, size_t bucket_count, 31 const int64_t *buckets); 32 33 void metrics_store_reset(metrics_store_t *store); 34 35 /* Accessors. */ 36 smartlist_t *metrics_store_get_all(const metrics_store_t *store, 37 const char *name); 38 void metrics_store_get_output(const metrics_format_t fmt, 39 const metrics_store_t *store, buf_t *data); 40 41 #ifdef METRICS_METRICS_STORE_PRIVATE 42 43 #endif /* METRICS_METRICS_STORE_PRIVATE. */ 44 45 #endif /* !defined(TOR_LIB_METRICS_METRICS_STORE_H) */