timeplus.generator

generator

This module defines stream generator source class
:copyright: (c) 2022 by Timeplus
:license: Apache2, see LICENSE for more details.

View Source
 0"""
 1generator
 2
 3This module defines stream generator source class  
 4:copyright: (c) 2022 by Timeplus  
 5:license: Apache2, see LICENSE for more details.  
 6"""
 7
 8from timeplus.base import Base
 9from timeplus.source import Source
10
11
12class GeneratorSource(Source):
13    """
14    GeneratorSource class defines stream generator source.
15    """
16
17    def __init__(self, env=None):
18        Source.__init__(self, env)
19        self.type("stream_generator")
20
21    def config(self, configuration):
22        properties = GeneratorProperties().configuration(configuration)
23        self.properties(properties)
24        return self
25
26
27class GeneratorProperties(Base):
28    """
29    GeneratorProperties class defines property of stream generator source.
30    """
31
32    def __init__(self):
33        Base.__init__(self)
34
35    def configuration(self, *args):
36        return self.prop("configuration", *args)
37
38
39class GeneratorConfiguration(Base):
40    """
41    GeneratorConfiguration class defines configuration property of stream generator source.
42    """
43
44    def __init__(self):
45        Base.__init__(self)
46        self._set("batch_size", 1)
47        self._set("interval", 1000)
48
49    def batch(self, *args):
50        return self.prop("batch_size", *args)
51
52    def interval(self, *args):
53        return self.prop("interval", *args)
54
55    def field(self, field_instance):
56        if "fields" not in self._data:
57            self._data["fields"] = []
58        self._data["fields"].append(field_instance.data())
59
60        return self
61
62
63class GeneratorField(Base):
64    """
65    GeneratorField class defines field property of stream generator source.
66    """
67
68    def __init__(self):
69        Base.__init__(self)
70
71    def name(self, *args):
72        return self.prop("name", *args)
73
74    def type(self, *args):
75        return self.prop("type", *args)
76
77    def limit(self, *args):
78        return self.prop("limit", *args)
79
80    def timestamp_format(self, *args):
81        return self.prop("timestamp_format", *args)
#   class GeneratorSource(timeplus.source.Source):
View Source
13class GeneratorSource(Source):
14    """
15    GeneratorSource class defines stream generator source.
16    """
17
18    def __init__(self, env=None):
19        Source.__init__(self, env)
20        self.type("stream_generator")
21
22    def config(self, configuration):
23        properties = GeneratorProperties().configuration(configuration)
24        self.properties(properties)
25        return self

GeneratorSource class defines stream generator source.

#   GeneratorSource(env=None)
View Source
18    def __init__(self, env=None):
19        Source.__init__(self, env)
20        self.type("stream_generator")
#   def config(self, configuration):
View Source
22    def config(self, configuration):
23        properties = GeneratorProperties().configuration(configuration)
24        self.properties(properties)
25        return self
#   class GeneratorProperties(timeplus.base.Base):
View Source
28class GeneratorProperties(Base):
29    """
30    GeneratorProperties class defines property of stream generator source.
31    """
32
33    def __init__(self):
34        Base.__init__(self)
35
36    def configuration(self, *args):
37        return self.prop("configuration", *args)

GeneratorProperties class defines property of stream generator source.

#   GeneratorProperties()
View Source
33    def __init__(self):
34        Base.__init__(self)
#   def configuration(self, *args):
View Source
36    def configuration(self, *args):
37        return self.prop("configuration", *args)
Inherited Members
timeplus.base.Base
prop
data
id
#   class GeneratorConfiguration(timeplus.base.Base):
View Source
40class GeneratorConfiguration(Base):
41    """
42    GeneratorConfiguration class defines configuration property of stream generator source.
43    """
44
45    def __init__(self):
46        Base.__init__(self)
47        self._set("batch_size", 1)
48        self._set("interval", 1000)
49
50    def batch(self, *args):
51        return self.prop("batch_size", *args)
52
53    def interval(self, *args):
54        return self.prop("interval", *args)
55
56    def field(self, field_instance):
57        if "fields" not in self._data:
58            self._data["fields"] = []
59        self._data["fields"].append(field_instance.data())
60
61        return self

GeneratorConfiguration class defines configuration property of stream generator source.

#   GeneratorConfiguration()
View Source
45    def __init__(self):
46        Base.__init__(self)
47        self._set("batch_size", 1)
48        self._set("interval", 1000)
#   def batch(self, *args):
View Source
50    def batch(self, *args):
51        return self.prop("batch_size", *args)
#   def interval(self, *args):
View Source
53    def interval(self, *args):
54        return self.prop("interval", *args)
#   def field(self, field_instance):
View Source
56    def field(self, field_instance):
57        if "fields" not in self._data:
58            self._data["fields"] = []
59        self._data["fields"].append(field_instance.data())
60
61        return self
Inherited Members
timeplus.base.Base
prop
data
id
#   class GeneratorField(timeplus.base.Base):
View Source
64class GeneratorField(Base):
65    """
66    GeneratorField class defines field property of stream generator source.
67    """
68
69    def __init__(self):
70        Base.__init__(self)
71
72    def name(self, *args):
73        return self.prop("name", *args)
74
75    def type(self, *args):
76        return self.prop("type", *args)
77
78    def limit(self, *args):
79        return self.prop("limit", *args)
80
81    def timestamp_format(self, *args):
82        return self.prop("timestamp_format", *args)

GeneratorField class defines field property of stream generator source.

#   GeneratorField()
View Source
69    def __init__(self):
70        Base.__init__(self)
#   def name(self, *args):
View Source
72    def name(self, *args):
73        return self.prop("name", *args)
#   def type(self, *args):
View Source
75    def type(self, *args):
76        return self.prop("type", *args)
#   def limit(self, *args):
View Source
78    def limit(self, *args):
79        return self.prop("limit", *args)
#   def timestamp_format(self, *args):
View Source
81    def timestamp_format(self, *args):
82        return self.prop("timestamp_format", *args)
Inherited Members
timeplus.base.Base
prop
data
id