- DICTSET_STR(r, "filename", filename);
- DICTSET_STR(r, "rrd_version", rrd.stat_head->version);
- DICTSET_CNT(r, "step", rrd.stat_head->pdp_step);
- DICTSET_CNT(r, "last_update", rrd.live_head->last_up);
-
- ds = PyDict_New();
- PyDict_SetItemString(r, "ds", ds);
- Py_DECREF(ds);
-
- for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
- PyObject *d;
-
- d = PyDict_New();
- PyDict_SetItemString(ds, rrd.ds_def[i].ds_nam, d);
- Py_DECREF(d);
-
- DICTSET_STR(d, "ds_name", rrd.ds_def[i].ds_nam);
- DICTSET_STR(d, "type", rrd.ds_def[i].dst);
- DICTSET_CNT(d, "minimal_heartbeat",
- rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt);
- DICTSET_VAL(d, "min", rrd.ds_def[i].par[DS_min_val].u_val);
- DICTSET_VAL(d, "max", rrd.ds_def[i].par[DS_max_val].u_val);
- DICTSET_STR(d, "last_ds", rrd.pdp_prep[i].last_ds);
- DICTSET_VAL(d, "value", rrd.pdp_prep[i].scratch[PDP_val].u_val);
- DICTSET_CNT(d, "unknown_sec",
- rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
+static char PyRRD_flushcached__doc__[] =
+ "flush(args..): flush RRD files from memory\n"
+ " flush [--daemon address] file [file ...]";
+
+static PyObject *PyRRD_flushcached(
+ PyObject UNUSED(*self),
+ PyObject * args)
+{
+ PyObject *r;
+ int argc;
+ char **argv;
+
+ if (create_args("flushcached", args, &argc, &argv) < 0)
+ return NULL;
+
+ if (rrd_flushcached(argc, argv) != 0) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ r = NULL;
+ } else {
+ Py_INCREF(Py_None);
+ r = Py_None;