nats-pure 0.7.2 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +201 -0
- data/README.md +251 -0
- data/lib/nats/client.rb +16 -0
- data/lib/nats/io/client.rb +1559 -1277
- data/lib/nats/io/errors.rb +74 -0
- data/lib/nats/io/jetstream/api.rb +309 -0
- data/lib/nats/io/jetstream/errors.rb +104 -0
- data/lib/nats/io/jetstream/js/config.rb +26 -0
- data/lib/nats/io/jetstream/js/header.rb +31 -0
- data/lib/nats/io/jetstream/js/status.rb +27 -0
- data/lib/nats/io/jetstream/js/sub.rb +30 -0
- data/lib/nats/io/jetstream/js.rb +93 -0
- data/lib/nats/io/jetstream/manager.rb +303 -0
- data/lib/nats/io/jetstream/msg/ack.rb +57 -0
- data/lib/nats/io/jetstream/msg/ack_methods.rb +111 -0
- data/lib/nats/io/jetstream/msg/metadata.rb +37 -0
- data/lib/nats/io/jetstream/msg.rb +26 -0
- data/lib/nats/io/jetstream/pull_subscription.rb +260 -0
- data/lib/nats/io/jetstream/push_subscription.rb +42 -0
- data/lib/nats/io/jetstream.rb +344 -0
- data/lib/nats/io/kv/api.rb +39 -0
- data/lib/nats/io/kv/bucket_status.rb +38 -0
- data/lib/nats/io/kv/errors.rb +60 -0
- data/lib/nats/io/kv/manager.rb +89 -0
- data/lib/nats/io/kv.rb +178 -0
- data/lib/nats/io/msg.rb +58 -0
- data/lib/nats/io/parser.rb +7 -7
- data/lib/nats/io/rails.rb +29 -0
- data/lib/nats/io/subscription.rb +157 -0
- data/lib/nats/io/version.rb +8 -4
- data/lib/nats/io/websocket.rb +75 -0
- data/lib/nats/nuid.rb +3 -1
- data/lib/nats.rb +39 -0
- data/sig/nats/io/client.rbs +304 -0
- data/sig/nats/io/errors.rbs +54 -0
- data/sig/nats/io/jetstream/api.rbs +35 -0
- data/sig/nats/io/jetstream/errors.rbs +54 -0
- data/sig/nats/io/jetstream/js/config.rbs +11 -0
- data/sig/nats/io/jetstream/js/header.rbs +17 -0
- data/sig/nats/io/jetstream/js/status.rbs +13 -0
- data/sig/nats/io/jetstream/js/sub.rbs +14 -0
- data/sig/nats/io/jetstream/js.rbs +27 -0
- data/sig/nats/io/jetstream/manager.rbs +33 -0
- data/sig/nats/io/jetstream/msg/ack.rbs +35 -0
- data/sig/nats/io/jetstream/msg/ack_methods.rbs +25 -0
- data/sig/nats/io/jetstream/msg/metadata.rbs +15 -0
- data/sig/nats/io/jetstream/msg.rbs +6 -0
- data/sig/nats/io/jetstream/pull_subscription.rbs +14 -0
- data/sig/nats/io/jetstream/push_subscription.rbs +7 -0
- data/sig/nats/io/jetstream.rbs +15 -0
- data/sig/nats/io/kv/api.rbs +8 -0
- data/sig/nats/io/kv/bucket_status.rbs +17 -0
- data/sig/nats/io/kv/errors.rbs +30 -0
- data/sig/nats/io/kv/manager.rbs +11 -0
- data/sig/nats/io/kv.rbs +39 -0
- data/sig/nats/io/msg.rbs +14 -0
- data/sig/nats/io/parser.rbs +32 -0
- data/sig/nats/io/subscription.rbs +33 -0
- data/sig/nats/io/version.rbs +9 -0
- data/sig/nats/nuid.rbs +32 -0
- metadata +74 -4
@@ -0,0 +1,35 @@
|
|
1
|
+
module NATS
|
2
|
+
class JetStream
|
3
|
+
module Msg
|
4
|
+
module Ack
|
5
|
+
Ack: '+ACK'
|
6
|
+
Nak: '-NAK'
|
7
|
+
Progress: '+WPI'
|
8
|
+
Term: '+TERM'
|
9
|
+
|
10
|
+
Empty: ''
|
11
|
+
DotSep: '.'
|
12
|
+
NoDomainName: '_'
|
13
|
+
|
14
|
+
Prefix0: '$JS'
|
15
|
+
Prefix1: 'ACK'
|
16
|
+
Domain: 2
|
17
|
+
AccHash: 3
|
18
|
+
Stream: 4
|
19
|
+
Consumer: 5
|
20
|
+
NumDelivered: 6
|
21
|
+
StreamSeq: 7
|
22
|
+
ConsumerSeq: 8
|
23
|
+
Timestamp: 9
|
24
|
+
NumPending: 10
|
25
|
+
|
26
|
+
V1TokenCounts: 9
|
27
|
+
|
28
|
+
V2TokenCounts: 12
|
29
|
+
|
30
|
+
class SequencePair < Struct[untyped]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module NATS
|
2
|
+
class JetStream
|
3
|
+
module Msg
|
4
|
+
module AckMethods
|
5
|
+
def ack: (**Hash[Symbol, untyped]) -> NATS::JetStream::PubAck
|
6
|
+
|
7
|
+
def ack_sync: (**Hash[Symbol, untyped]) -> NATS::JetStream::PubAck
|
8
|
+
|
9
|
+
def nak: (**Hash[Symbol, untyped]) -> NATS::JetStream::PubAck
|
10
|
+
|
11
|
+
def term: (**Hash[Symbol, untyped]) -> NATS::JetStream::PubAck
|
12
|
+
|
13
|
+
def in_progress: (**Hash[Symbol, untyped]) -> NATS::JetStream::PubAck
|
14
|
+
|
15
|
+
def metadata: () -> NATS::JetStream::Msg::Metadata
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def ensure_is_acked_once!: () -> void
|
20
|
+
|
21
|
+
def parse_metadata: (String) -> NATS::JetStream::Msg::Metadata
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module NATS
|
2
|
+
class JetStream
|
3
|
+
module Msg
|
4
|
+
module Metadata
|
5
|
+
attr_reader sequence: Ack::SequencePair
|
6
|
+
attr_reader num_delivered: Integer
|
7
|
+
attr_reader num_pending: Integer
|
8
|
+
attr_reader timestamp: Time
|
9
|
+
attr_reader stream: String
|
10
|
+
attr_reader consumer: String
|
11
|
+
attr_reader domain: String
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module NATS
|
2
|
+
class JetStream
|
3
|
+
module PullSubscription
|
4
|
+
class PubAck < Struct[String | Numeric | bool]
|
5
|
+
end
|
6
|
+
|
7
|
+
def next_msg: (untyped) -> void
|
8
|
+
|
9
|
+
def fetch: (Integer, Hash[Symbol, untyped]) -> Array[NATS::Msg]
|
10
|
+
|
11
|
+
def consumer_info: (Hash[Symbol, untyped]) -> NATS::JetStream::ConsumerInfo
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module NATS
|
2
|
+
class JetStream
|
3
|
+
extend Manager
|
4
|
+
extend KeyValue::Manager
|
5
|
+
|
6
|
+
class PubAck < Struct[String | Numeric | bool]
|
7
|
+
end
|
8
|
+
|
9
|
+
def publish: (String, String, Hash[Symbol, untyped]) -> NATS::JetStream::PubAck
|
10
|
+
|
11
|
+
def subscribe: (String, Hash[Symbol, untyped]) { (?(NATS::Msg | String), ?String, ?String, ?Hash[Symbol, untyped]) -> void } -> NATS::JetStream::PushSubscription
|
12
|
+
|
13
|
+
def pull_subscribe: (String, String, Hash[Symbol, untyped]) -> NATS::JetStream::PullSubscription
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module NATS
|
2
|
+
class KeyValue
|
3
|
+
module BucketStatus
|
4
|
+
attr_reader bucket: String
|
5
|
+
|
6
|
+
@nfo: JetStream::API::StreamInfo
|
7
|
+
|
8
|
+
def initialize: (JetStream::API::StreamInfo, String) -> void
|
9
|
+
|
10
|
+
def values: () -> Integer
|
11
|
+
|
12
|
+
def history: () -> Integer
|
13
|
+
|
14
|
+
def ttl: () -> Float
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module NATS
|
2
|
+
class KeyValue
|
3
|
+
class Error < NATS::Error
|
4
|
+
end
|
5
|
+
|
6
|
+
class KeyNotFoundError < NATS::KeyValue::Error
|
7
|
+
attr_reader entry: NATS::KeyValue::Entry
|
8
|
+
attr_reader op: String
|
9
|
+
|
10
|
+
@message: String
|
11
|
+
|
12
|
+
def initialize: (Hash[Symbol, untyped]) -> void
|
13
|
+
end
|
14
|
+
|
15
|
+
class KeyDeletedError < NATS::KeyValue::KeyNotFoundError
|
16
|
+
end
|
17
|
+
|
18
|
+
class BucketNotFoundError < NATS::KeyValue::Error
|
19
|
+
end
|
20
|
+
|
21
|
+
class BadBucketError < NATS::KeyValue::Error
|
22
|
+
end
|
23
|
+
|
24
|
+
class KeyWrongLastSequenceError < NATS::KeyValue::Error
|
25
|
+
@msg: String
|
26
|
+
|
27
|
+
def initialize: (String) -> void
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/sig/nats/io/kv.rbs
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
module NATS
|
2
|
+
class KeyValue
|
3
|
+
KV_OP: 'KV-Operation'
|
4
|
+
KV_DEL: 'DEL'
|
5
|
+
KV_PURGE: 'PURGE'
|
6
|
+
MSG_ROLLUP_SUBJECT: 'sub'
|
7
|
+
MSG_ROLLUP_ALL: 'all'
|
8
|
+
ROLLUP: 'Nats-Rollup'
|
9
|
+
|
10
|
+
@name: String
|
11
|
+
@stream: String
|
12
|
+
@pre: String
|
13
|
+
@js: NATS::JetStream
|
14
|
+
@direct: bool
|
15
|
+
|
16
|
+
def initialize: (Hash[Symbol, untyped]) -> void
|
17
|
+
|
18
|
+
def get: (String, ?Hash[Symbol, untyped]) -> NATS::KeyValue::Entry
|
19
|
+
|
20
|
+
private def _get: (String, ?Hash[Symbol, untyped]) -> NATS::KeyValue::Entry
|
21
|
+
|
22
|
+
def put: (String, untyped) -> Integer
|
23
|
+
|
24
|
+
def create: (String, untyped) -> Integer
|
25
|
+
|
26
|
+
EXPECTED_LAST_SUBJECT_SEQUENCE: 'Nats-Expected-Last-Subject-Sequence'
|
27
|
+
|
28
|
+
def update: (String, untyped, ?Hash[Symbol, untyped]) -> Integer
|
29
|
+
|
30
|
+
def delete: (String, ?Hash[Symbol, untyped]) -> Integer
|
31
|
+
|
32
|
+
def purge: (String) -> NATS::JetStream::PubAck
|
33
|
+
|
34
|
+
def status: () -> NATS::KeyValue::BucketStatus
|
35
|
+
|
36
|
+
class Entry < Struct[untyped]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/sig/nats/io/msg.rbs
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module NATS
|
2
|
+
class Msg
|
3
|
+
attr_reader subject: String
|
4
|
+
attr_reader reply: String?
|
5
|
+
attr_reader data: String
|
6
|
+
attr_reader header: String
|
7
|
+
|
8
|
+
include NATS::JetStream::Msg::AckMethods
|
9
|
+
|
10
|
+
def respond: (?String) -> void
|
11
|
+
|
12
|
+
def respond_msg: (NATS::Msg) -> void
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module NATS
|
2
|
+
module Protocol
|
3
|
+
MSG: Regexp
|
4
|
+
HMSG: Regexp
|
5
|
+
OK: Regexp
|
6
|
+
ERR: Regexp
|
7
|
+
PING: Regexp
|
8
|
+
PONG: Regexp
|
9
|
+
INFO: Regexp
|
10
|
+
UNKNOWN: Regexp
|
11
|
+
|
12
|
+
AWAITING_CONTROL_LINE: 1
|
13
|
+
AWAITING_MSG_PAYLOAD: 2
|
14
|
+
|
15
|
+
CR_LF: '\r\n'
|
16
|
+
CR_LF_SIZE: Integer
|
17
|
+
|
18
|
+
PING_REQUEST: String
|
19
|
+
PONG_RESPONSE: String
|
20
|
+
|
21
|
+
SUB_OP: 'SUB'
|
22
|
+
EMPTY_MSG: ''
|
23
|
+
|
24
|
+
class Parser
|
25
|
+
def initialize: (NATS::Client) -> void
|
26
|
+
|
27
|
+
def reset!: () -> void
|
28
|
+
|
29
|
+
def parse: (String) -> void
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module NATS
|
2
|
+
class Subscription
|
3
|
+
include MonitorMixin
|
4
|
+
|
5
|
+
attr_accessor subject: String
|
6
|
+
attr_accessor queue: untyped
|
7
|
+
attr_accessor future: MonitorMixin::ConditionVariable?
|
8
|
+
attr_accessor callback: Proc?
|
9
|
+
attr_accessor response: NATS::Msg?
|
10
|
+
attr_accessor received: Integer
|
11
|
+
attr_accessor max: Integer?
|
12
|
+
attr_accessor pending: untyped
|
13
|
+
attr_accessor sid: Integer?
|
14
|
+
|
15
|
+
attr_accessor pending_queue: Thread::SizedQueue?
|
16
|
+
attr_accessor pending_size: Integer
|
17
|
+
attr_accessor wait_for_msgs_cond: MonitorMixin::ConditionVariable?
|
18
|
+
|
19
|
+
attr_accessor pending_msgs_limit: Integer?
|
20
|
+
attr_accessor pending_bytes_limit: Integer?
|
21
|
+
|
22
|
+
attr_accessor nc: NATS::Client?
|
23
|
+
attr_accessor jsi: NATS::JetStream::JS::Sub
|
24
|
+
attr_accessor closed: bool?
|
25
|
+
|
26
|
+
attr_accessor processing_concurrency: Integer
|
27
|
+
attr_reader concurrency_semaphore: Concurrent::Semaphore
|
28
|
+
|
29
|
+
def unsubscribe: (?Integer?) -> void
|
30
|
+
|
31
|
+
def next_msg: (Hash[Symbol, untyped]?) -> NATS::Msg
|
32
|
+
end
|
33
|
+
end
|
data/sig/nats/nuid.rbs
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module NATS
|
2
|
+
class NUID
|
3
|
+
DIGITS: Array[String]
|
4
|
+
BASE: Integer
|
5
|
+
PREFIX_LENGTH: Integer
|
6
|
+
SEQ_LENGTH: Integer
|
7
|
+
TOTAL_LENGTH: Integer
|
8
|
+
MAX_SEQ: Integer
|
9
|
+
MIN_INC: Integer
|
10
|
+
MAX_INC: Integer
|
11
|
+
INC: Integer
|
12
|
+
|
13
|
+
@prand: Random
|
14
|
+
@seq: Integer
|
15
|
+
@inc: Integer
|
16
|
+
@prefix: String
|
17
|
+
|
18
|
+
def next: () -> String
|
19
|
+
|
20
|
+
def randomize_prefix!: () -> String
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def reset_sequential!: () -> Integer
|
25
|
+
|
26
|
+
# class << self
|
27
|
+
@@nuid: NUID
|
28
|
+
|
29
|
+
def self.next: () -> String
|
30
|
+
# end class << self
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nats-pure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Waldemar Quevedo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2023-11-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: concurrent-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
13
27
|
description: NATS is an open-source, high-performance, lightweight cloud messaging
|
14
28
|
system.
|
15
29
|
email:
|
@@ -18,10 +32,66 @@ executables: []
|
|
18
32
|
extensions: []
|
19
33
|
extra_rdoc_files: []
|
20
34
|
files:
|
35
|
+
- LICENSE
|
36
|
+
- README.md
|
37
|
+
- lib/nats.rb
|
38
|
+
- lib/nats/client.rb
|
21
39
|
- lib/nats/io/client.rb
|
40
|
+
- lib/nats/io/errors.rb
|
41
|
+
- lib/nats/io/jetstream.rb
|
42
|
+
- lib/nats/io/jetstream/api.rb
|
43
|
+
- lib/nats/io/jetstream/errors.rb
|
44
|
+
- lib/nats/io/jetstream/js.rb
|
45
|
+
- lib/nats/io/jetstream/js/config.rb
|
46
|
+
- lib/nats/io/jetstream/js/header.rb
|
47
|
+
- lib/nats/io/jetstream/js/status.rb
|
48
|
+
- lib/nats/io/jetstream/js/sub.rb
|
49
|
+
- lib/nats/io/jetstream/manager.rb
|
50
|
+
- lib/nats/io/jetstream/msg.rb
|
51
|
+
- lib/nats/io/jetstream/msg/ack.rb
|
52
|
+
- lib/nats/io/jetstream/msg/ack_methods.rb
|
53
|
+
- lib/nats/io/jetstream/msg/metadata.rb
|
54
|
+
- lib/nats/io/jetstream/pull_subscription.rb
|
55
|
+
- lib/nats/io/jetstream/push_subscription.rb
|
56
|
+
- lib/nats/io/kv.rb
|
57
|
+
- lib/nats/io/kv/api.rb
|
58
|
+
- lib/nats/io/kv/bucket_status.rb
|
59
|
+
- lib/nats/io/kv/errors.rb
|
60
|
+
- lib/nats/io/kv/manager.rb
|
61
|
+
- lib/nats/io/msg.rb
|
22
62
|
- lib/nats/io/parser.rb
|
63
|
+
- lib/nats/io/rails.rb
|
64
|
+
- lib/nats/io/subscription.rb
|
23
65
|
- lib/nats/io/version.rb
|
66
|
+
- lib/nats/io/websocket.rb
|
24
67
|
- lib/nats/nuid.rb
|
68
|
+
- sig/nats/io/client.rbs
|
69
|
+
- sig/nats/io/errors.rbs
|
70
|
+
- sig/nats/io/jetstream.rbs
|
71
|
+
- sig/nats/io/jetstream/api.rbs
|
72
|
+
- sig/nats/io/jetstream/errors.rbs
|
73
|
+
- sig/nats/io/jetstream/js.rbs
|
74
|
+
- sig/nats/io/jetstream/js/config.rbs
|
75
|
+
- sig/nats/io/jetstream/js/header.rbs
|
76
|
+
- sig/nats/io/jetstream/js/status.rbs
|
77
|
+
- sig/nats/io/jetstream/js/sub.rbs
|
78
|
+
- sig/nats/io/jetstream/manager.rbs
|
79
|
+
- sig/nats/io/jetstream/msg.rbs
|
80
|
+
- sig/nats/io/jetstream/msg/ack.rbs
|
81
|
+
- sig/nats/io/jetstream/msg/ack_methods.rbs
|
82
|
+
- sig/nats/io/jetstream/msg/metadata.rbs
|
83
|
+
- sig/nats/io/jetstream/pull_subscription.rbs
|
84
|
+
- sig/nats/io/jetstream/push_subscription.rbs
|
85
|
+
- sig/nats/io/kv.rbs
|
86
|
+
- sig/nats/io/kv/api.rbs
|
87
|
+
- sig/nats/io/kv/bucket_status.rbs
|
88
|
+
- sig/nats/io/kv/errors.rbs
|
89
|
+
- sig/nats/io/kv/manager.rbs
|
90
|
+
- sig/nats/io/msg.rbs
|
91
|
+
- sig/nats/io/parser.rbs
|
92
|
+
- sig/nats/io/subscription.rbs
|
93
|
+
- sig/nats/io/version.rbs
|
94
|
+
- sig/nats/nuid.rbs
|
25
95
|
homepage: https://nats.io
|
26
96
|
licenses:
|
27
97
|
- Apache-2.0
|
@@ -41,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
111
|
- !ruby/object:Gem::Version
|
42
112
|
version: '0'
|
43
113
|
requirements: []
|
44
|
-
rubygems_version: 3.
|
114
|
+
rubygems_version: 3.4.1
|
45
115
|
signing_key:
|
46
116
|
specification_version: 4
|
47
117
|
summary: NATS is an open-source, high-performance, lightweight cloud messaging system.
|