1 /**
2 * collectd - src/utils_cache.h
3 * Copyright (C) 2007 Florian octo Forster
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 *
23 * Authors:
24 * Florian octo Forster <octo at collectd.org>
25 **/
27 #ifndef UTILS_CACHE_H
28 #define UTILS_CACHE_H 1
30 #include "plugin.h"
32 #define STATE_OKAY 0
33 #define STATE_WARNING 1
34 #define STATE_ERROR 2
35 #define STATE_MISSING 15
37 int uc_init (void);
38 int uc_check_timeout (void);
39 int uc_update (const data_set_t *ds, const value_list_t *vl);
40 int uc_get_rate_by_name (const char *name, gauge_t **ret_values, size_t *ret_values_num);
41 gauge_t *uc_get_rate (const data_set_t *ds, const value_list_t *vl);
43 size_t uc_get_size();
44 int uc_get_names (char ***ret_names, cdtime_t **ret_times, size_t *ret_number);
46 int uc_get_state (const data_set_t *ds, const value_list_t *vl);
47 int uc_set_state (const data_set_t *ds, const value_list_t *vl, int state);
48 int uc_get_hits (const data_set_t *ds, const value_list_t *vl);
49 int uc_set_hits (const data_set_t *ds, const value_list_t *vl, int hits);
50 int uc_inc_hits (const data_set_t *ds, const value_list_t *vl, int step);
52 int uc_get_history (const data_set_t *ds, const value_list_t *vl,
53 gauge_t *ret_history, size_t num_steps, size_t num_ds);
54 int uc_get_history_by_name (const char *name,
55 gauge_t *ret_history, size_t num_steps, size_t num_ds);
57 /*
58 * Meta data interface
59 */
60 int uc_meta_data_exists (const value_list_t *vl, const char *key);
61 int uc_meta_data_delete (const value_list_t *vl, const char *key);
63 int uc_meta_data_add_string (const value_list_t *vl,
64 const char *key,
65 const char *value);
66 int uc_meta_data_add_signed_int (const value_list_t *vl,
67 const char *key,
68 int64_t value);
69 int uc_meta_data_add_unsigned_int (const value_list_t *vl,
70 const char *key,
71 uint64_t value);
72 int uc_meta_data_add_double (const value_list_t *vl,
73 const char *key,
74 double value);
75 int uc_meta_data_add_boolean (const value_list_t *vl,
76 const char *key,
77 _Bool value);
79 int uc_meta_data_get_string (const value_list_t *vl,
80 const char *key,
81 char **value);
82 int uc_meta_data_get_signed_int (const value_list_t *vl,
83 const char *key,
84 int64_t *value);
85 int uc_meta_data_get_unsigned_int (const value_list_t *vl,
86 const char *key,
87 uint64_t *value);
88 int uc_meta_data_get_double (const value_list_t *vl,
89 const char *key,
90 double *value);
91 int uc_meta_data_get_boolean (const value_list_t *vl,
92 const char *key,
93 _Bool *value);
95 /* vim: set shiftwidth=2 softtabstop=2 tabstop=8 : */
96 #endif /* !UTILS_CACHE_H */