encoder.pxd 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. from util.generic.string cimport TStringBuf, TString
  2. from util.generic.ptr cimport THolder
  3. from util.stream.output cimport IOutputStream
  4. from library.python.monlib.metric_consumer cimport IMetricConsumer
  5. cdef extern from "util/stream/input.h" nogil:
  6. cdef cppclass IInputStream:
  7. pass
  8. cdef extern from "util/system/file.h" nogil:
  9. cdef cppclass TFile:
  10. TFile()
  11. TFile(TFile)
  12. pass
  13. cdef TFile Duplicate(int)
  14. cdef extern from "library/cpp/monlib/encode/encoder.h" namespace "NMonitoring" nogil:
  15. cdef cppclass IMetricEncoder:
  16. void Close()
  17. cdef cppclass ECompression:
  18. pass
  19. ctypedef THolder[IMetricEncoder] IMetricEncoderPtr
  20. cdef extern from "library/cpp/monlib/encode/unistat/unistat.h" namespace "NMonitoring" nogil:
  21. cdef void DecodeUnistat(TStringBuf data, IMetricConsumer* c)
  22. cdef extern from "library/cpp/monlib/encode/json/json.h" namespace "NMonitoring" nogil:
  23. cdef IMetricEncoderPtr EncoderJson(IOutputStream* out, int indentation)
  24. cdef IMetricEncoderPtr BufferedEncoderJson(IOutputStream* out, int indentation)
  25. cdef void DecodeJson(TStringBuf data, IMetricConsumer* c)
  26. cdef extern from "library/cpp/monlib/encode/spack/spack_v1.h" namespace "NMonitoring" nogil:
  27. cdef IMetricEncoderPtr EncoderSpackV1(IOutputStream* out, ETimePrecision, ECompression)
  28. cdef void DecodeSpackV1(IInputStream* input, IMetricConsumer* c) except +
  29. cdef cppclass ETimePrecision:
  30. pass
  31. cdef cppclass EValueType:
  32. pass
  33. cdef extern from "library/cpp/monlib/encode/spack/spack_v1.h" namespace "NMonitoring::ETimePrecision" nogil:
  34. cdef ETimePrecision SECONDS "NMonitoring::ETimePrecision::SECONDS"
  35. cdef ETimePrecision MILLIS "NMonitoring::ETimePrecision::MILLIS"
  36. cdef extern from "library/cpp/monlib/encode/encoder.h" namespace "NMonitoring::ECompression" nogil:
  37. cdef ECompression UNKNOWN "NMonitoring::ECompression::UNKNOWN"
  38. cdef ECompression IDENTITY "NMonitoring::ECompression::IDENTITY"
  39. cdef ECompression ZLIB "NMonitoring::ECompression::ZLIB"
  40. cdef ECompression LZ4 "NMonitoring::ECompression::LZ4"
  41. cdef ECompression ZSTD "NMonitoring::ECompression::ZSTD"
  42. cdef class Encoder:
  43. cdef IMetricEncoderPtr __wrapped
  44. cdef THolder[TFile] __file
  45. cdef THolder[IOutputStream] __stream
  46. cdef IMetricEncoder* native(self)
  47. cdef _make_stream(self, py_stream)
  48. @staticmethod
  49. cdef Encoder create_spack(object stream, ETimePrecision timePrecision, ECompression compression)
  50. @staticmethod
  51. cdef Encoder create_json(object stream, int indent)