aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/monlib/encoder.pxd
blob: f879b66b785c69e2c979cecd59154281bbb83563 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
from util.generic.string cimport TStringBuf, TString
from util.generic.ptr cimport THolder
from util.stream.output cimport IOutputStream

from library.python.monlib.metric_consumer cimport IMetricConsumer


cdef extern from "util/stream/input.h" nogil:
    cdef cppclass IInputStream:
        pass


cdef extern from "util/system/file.h" nogil:
    cdef cppclass TFile:
        TFile()
        TFile(TFile)
        pass

    cdef TFile Duplicate(int)


cdef extern from "library/cpp/monlib/encode/encoder.h" namespace "NMonitoring" nogil:
    cdef cppclass IMetricEncoder:
        void Close()

    cdef cppclass ECompression:
        pass

    ctypedef THolder[IMetricEncoder] IMetricEncoderPtr


cdef extern from "library/cpp/monlib/encode/unistat/unistat.h" namespace "NMonitoring" nogil:
    cdef void DecodeUnistat(TStringBuf data, IMetricConsumer* c)


cdef extern from "library/cpp/monlib/encode/json/json.h" namespace "NMonitoring" nogil:
    cdef IMetricEncoderPtr EncoderJson(IOutputStream* out, int indentation)
    cdef IMetricEncoderPtr BufferedEncoderJson(IOutputStream* out, int indentation)

    cdef void DecodeJson(TStringBuf data, IMetricConsumer* c)


cdef extern from "library/cpp/monlib/encode/spack/spack_v1.h" namespace "NMonitoring" nogil:
    cdef IMetricEncoderPtr EncoderSpackV1(IOutputStream* out, ETimePrecision, ECompression)

    cdef void DecodeSpackV1(IInputStream* input, IMetricConsumer* c) except +
    cdef cppclass ETimePrecision:
        pass

    cdef cppclass EValueType:
        pass


cdef extern from "library/cpp/monlib/encode/spack/spack_v1.h" namespace "NMonitoring::ETimePrecision" nogil:
    cdef ETimePrecision SECONDS "NMonitoring::ETimePrecision::SECONDS"
    cdef ETimePrecision MILLIS "NMonitoring::ETimePrecision::MILLIS"


cdef extern from "library/cpp/monlib/encode/encoder.h" namespace "NMonitoring::ECompression" nogil:
    cdef ECompression UNKNOWN "NMonitoring::ECompression::UNKNOWN"
    cdef ECompression IDENTITY "NMonitoring::ECompression::IDENTITY"
    cdef ECompression ZLIB "NMonitoring::ECompression::ZLIB"
    cdef ECompression LZ4 "NMonitoring::ECompression::LZ4"
    cdef ECompression ZSTD "NMonitoring::ECompression::ZSTD"


cdef class Encoder:
    cdef IMetricEncoderPtr __wrapped
    cdef THolder[TFile] __file
    cdef THolder[IOutputStream] __stream

    cdef IMetricEncoder* native(self)

    cdef _make_stream(self, py_stream)

    @staticmethod
    cdef Encoder create_spack(object stream, ETimePrecision timePrecision, ECompression compression)
    @staticmethod
    cdef Encoder create_json(object stream, int indent)