X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=bindings%2Fpython%2Frrdtoolmodule.c;h=bd16da17e69ffee7f30c29210dc7569c4001caa6;hp=2771720711310ab670cfc1e0ac2589122cae0c2d;hb=4d2717c87ff413758caaa7942d211e642846b9b0;hpb=4ee4e5e084caeb4a3af3aefe3c5122b27cb111b4 diff --git a/bindings/python/rrdtoolmodule.c b/bindings/python/rrdtoolmodule.c index 2771720..bd16da1 100644 --- a/bindings/python/rrdtoolmodule.c +++ b/bindings/python/rrdtoolmodule.c @@ -516,6 +516,34 @@ static PyObject *PyRRD_updatev( return r; } +static char PyRRD_flush__doc__[] = + "flush(args..): flush RRD files from memory\n" + " flush [--daemon address] file [file ...]"; + +static PyObject *PyRRD_flush( + PyObject UNUSED(*self), + PyObject * args) +{ + PyObject *r; + int argc; + char **argv; + + if (create_args("flush", args, &argc, &argv) < 0) + return NULL; + + if (rrd_cmd_flush(argc, argv) != 0) { + PyErr_SetString(ErrorObject, rrd_get_error()); + rrd_clear_error(); + r = NULL; + } else { + Py_INCREF(Py_None); + r = Py_None; + } + + destroy_args(&argv); + return r; +} + /* List of methods defined in the module */ #define meth(name, func, doc) {name, (PyCFunction)func, METH_VARARGS, doc} @@ -531,6 +559,7 @@ static PyMethodDef _rrdtool_methods[] = { meth("info", PyRRD_info, PyRRD_info__doc__), meth("graphv", PyRRD_graphv, PyRRD_graphv__doc__), meth("updatev", PyRRD_updatev, PyRRD_updatev__doc__), + meth("flush", PyRRD_flush, PyRRD_flush__doc__), {NULL, NULL, 0, NULL} };