prosody 0.5.0-aarch64-linux → 0.6.0-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.cargo/config.toml +5 -0
- data/.config/rail.toml +26 -0
- data/.release-please-manifest.json +1 -1
- data/.ruby-version +1 -1
- data/.taplo.toml +1 -1
- data/AGENTS.md +29 -15
- data/CHANGELOG.md +14 -0
- data/CLAUDE.md +29 -15
- data/CONFIGURATION.md +19 -16
- data/README.md +100 -23
- data/examples/keyed_state.rb +10 -2
- data/examples/keyed_state.rbs +1 -0
- data/lib/prosody/3.2/prosody.so +2 -2
- data/lib/prosody/3.3/prosody.so +2 -2
- data/lib/prosody/3.4/prosody.so +2 -2
- data/lib/prosody/client.rb +32 -0
- data/lib/prosody/configuration.rb +20 -12
- data/lib/prosody/demand.rb +27 -0
- data/lib/prosody/native_stubs/client.rb +157 -0
- data/lib/prosody/native_stubs/context.rb +178 -0
- data/lib/prosody/native_stubs/message.rb +133 -0
- data/lib/prosody/native_stubs.rb +11 -956
- data/lib/prosody/state/deque.rb +253 -0
- data/lib/prosody/state/map.rb +313 -0
- data/lib/prosody/state/set.rb +121 -0
- data/lib/prosody/state/value.rb +58 -0
- data/lib/prosody/state.rb +157 -677
- data/lib/prosody/version.rb +1 -1
- data/lib/prosody.rb +2 -1
- data/sig/configuration.rbs +19 -10
- data/sig/prosody.rbs +37 -4
- data/sig/published.rbs +102 -0
- data/sig/state.rbs +109 -122
- data/typecheck/payload_types.rb +12 -0
- data/typecheck/payload_types.rbs +1 -0
- metadata +19 -8
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Native stubs for the event types that reach a handler: {Prosody::Message},
|
|
4
|
+
# {Prosody::ExciseMessage}, and {Prosody::Timer}.
|
|
5
|
+
|
|
6
|
+
module Prosody
|
|
7
|
+
# Represents a Kafka message with its metadata and payload.
|
|
8
|
+
#
|
|
9
|
+
# Instances of this class are created by the native code and passed to your
|
|
10
|
+
# EventHandler's #on_message method. In RBS, +Message[Payload]+ carries the
|
|
11
|
+
# statically declared payload shape; bare +Message+ defaults to
|
|
12
|
+
# +Prosody::json_value+. This annotation does not add runtime validation.
|
|
13
|
+
#
|
|
14
|
+
# @see ext/prosody/src/handler/message.rs for implementation
|
|
15
|
+
class Message
|
|
16
|
+
# Returns the Kafka topic this message was published to.
|
|
17
|
+
#
|
|
18
|
+
# @return [String] The topic name
|
|
19
|
+
def topic
|
|
20
|
+
raise NotImplementedError, "This method is implemented natively in Rust"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Returns the Kafka partition number for this message.
|
|
24
|
+
#
|
|
25
|
+
# @return [Integer] The partition number
|
|
26
|
+
def partition
|
|
27
|
+
raise NotImplementedError, "This method is implemented natively in Rust"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns the Kafka offset of this message within its partition.
|
|
31
|
+
#
|
|
32
|
+
# @return [Integer] The message offset
|
|
33
|
+
def offset
|
|
34
|
+
raise NotImplementedError, "This method is implemented natively in Rust"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns the message key used for partitioning.
|
|
38
|
+
#
|
|
39
|
+
# @return [String] The message key
|
|
40
|
+
def key
|
|
41
|
+
raise NotImplementedError, "This method is implemented natively in Rust"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Returns the timestamp when the message was created.
|
|
45
|
+
#
|
|
46
|
+
# @return [Time] The message timestamp
|
|
47
|
+
def timestamp
|
|
48
|
+
raise NotImplementedError, "This method is implemented natively in Rust"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Returns the deserialized message payload.
|
|
52
|
+
#
|
|
53
|
+
# The payload is automatically deserialized from JSON to Ruby objects.
|
|
54
|
+
#
|
|
55
|
+
# @return [Payload] The message content
|
|
56
|
+
def payload
|
|
57
|
+
raise NotImplementedError, "This method is implemented natively in Rust"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Returns the source system of the producer that sent this message.
|
|
61
|
+
#
|
|
62
|
+
# @return [String, nil] The source system, or nil when the message has none
|
|
63
|
+
def source_system
|
|
64
|
+
raise NotImplementedError, "This method is implemented natively in Rust"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Reports whether the producer requested a response to this message.
|
|
68
|
+
# Prosody discards the handler result when it is false.
|
|
69
|
+
#
|
|
70
|
+
# @return [Boolean]
|
|
71
|
+
def response_requested?
|
|
72
|
+
raise NotImplementedError, "This method is implemented natively in Rust"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# An excise record with Kafka metadata and no payload.
|
|
77
|
+
class ExciseMessage
|
|
78
|
+
# @return [String] The topic name
|
|
79
|
+
def topic = raise NotImplementedError, "This method is implemented natively in Rust"
|
|
80
|
+
|
|
81
|
+
# @return [Integer] The partition number
|
|
82
|
+
def partition = raise NotImplementedError, "This method is implemented natively in Rust"
|
|
83
|
+
|
|
84
|
+
# @return [Integer] The message offset
|
|
85
|
+
def offset = raise NotImplementedError, "This method is implemented natively in Rust"
|
|
86
|
+
|
|
87
|
+
# @return [String] The message key
|
|
88
|
+
def key = raise NotImplementedError, "This method is implemented natively in Rust"
|
|
89
|
+
|
|
90
|
+
# @return [Time] The record timestamp
|
|
91
|
+
def timestamp = raise NotImplementedError, "This method is implemented natively in Rust"
|
|
92
|
+
|
|
93
|
+
# @return [String, nil] The producer's source system, or nil when the record has none
|
|
94
|
+
def source_system = raise NotImplementedError, "This method is implemented natively in Rust"
|
|
95
|
+
|
|
96
|
+
# @return [Boolean] Whether the producer requested a response to this record
|
|
97
|
+
def response_requested? = raise NotImplementedError, "This method is implemented natively in Rust"
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Represents a timer that was scheduled to fire at a specific time.
|
|
101
|
+
#
|
|
102
|
+
# Timer instances are created by the native code and passed to your
|
|
103
|
+
# EventHandler's #on_timer method when a scheduled timer fires.
|
|
104
|
+
#
|
|
105
|
+
# @see ext/prosody/src/handler/trigger.rs for implementation
|
|
106
|
+
class Timer
|
|
107
|
+
# @private
|
|
108
|
+
def initialize
|
|
109
|
+
raise NotImplementedError, "This class is implemented natively in Rust"
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Returns the entity key identifying what this timer belongs to.
|
|
113
|
+
#
|
|
114
|
+
# The key is typically the same as the message key that was being processed
|
|
115
|
+
# when the timer was scheduled.
|
|
116
|
+
#
|
|
117
|
+
# @return [String] The entity key
|
|
118
|
+
def key
|
|
119
|
+
raise NotImplementedError, "This method is implemented natively in Rust"
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Returns the time when this timer was scheduled to fire.
|
|
123
|
+
#
|
|
124
|
+
# Note: Due to CompactDateTime's second-level precision, the returned time
|
|
125
|
+
# will have zero nanoseconds even if the original scheduled time had
|
|
126
|
+
# sub-second precision.
|
|
127
|
+
#
|
|
128
|
+
# @return [Time] The scheduled execution time
|
|
129
|
+
def time
|
|
130
|
+
raise NotImplementedError, "This method is implemented natively in Rust"
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|