nats-pure 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +201 -0
  3. data/README.md +251 -0
  4. data/lib/nats/io/client.rb +226 -151
  5. data/lib/nats/io/errors.rb +6 -0
  6. data/lib/nats/io/jetstream/api.rb +305 -0
  7. data/lib/nats/io/jetstream/errors.rb +104 -0
  8. data/lib/nats/io/jetstream/js/config.rb +26 -0
  9. data/lib/nats/io/jetstream/js/header.rb +31 -0
  10. data/lib/nats/io/jetstream/js/status.rb +27 -0
  11. data/lib/nats/io/jetstream/js/sub.rb +30 -0
  12. data/lib/nats/io/jetstream/js.rb +93 -0
  13. data/lib/nats/io/jetstream/manager.rb +284 -0
  14. data/lib/nats/io/jetstream/msg/ack.rb +57 -0
  15. data/lib/nats/io/jetstream/msg/ack_methods.rb +111 -0
  16. data/lib/nats/io/jetstream/msg/metadata.rb +37 -0
  17. data/lib/nats/io/jetstream/msg.rb +26 -0
  18. data/lib/nats/io/jetstream/pull_subscription.rb +260 -0
  19. data/lib/nats/io/jetstream/push_subscription.rb +42 -0
  20. data/lib/nats/io/jetstream.rb +269 -0
  21. data/lib/nats/io/kv/api.rb +39 -0
  22. data/lib/nats/io/kv/bucket_status.rb +38 -0
  23. data/lib/nats/io/kv/errors.rb +60 -0
  24. data/lib/nats/io/kv/manager.rb +89 -0
  25. data/lib/nats/io/kv.rb +5 -157
  26. data/lib/nats/io/msg.rb +4 -2
  27. data/lib/nats/io/rails.rb +29 -0
  28. data/lib/nats/io/subscription.rb +70 -5
  29. data/lib/nats/io/version.rb +1 -1
  30. data/lib/nats/io/websocket.rb +75 -0
  31. data/sig/nats/io/client.rbs +304 -0
  32. data/sig/nats/io/errors.rbs +54 -0
  33. data/sig/nats/io/jetstream/api.rbs +35 -0
  34. data/sig/nats/io/jetstream/errors.rbs +54 -0
  35. data/sig/nats/io/jetstream/js/config.rbs +11 -0
  36. data/sig/nats/io/jetstream/js/header.rbs +17 -0
  37. data/sig/nats/io/jetstream/js/status.rbs +13 -0
  38. data/sig/nats/io/jetstream/js/sub.rbs +14 -0
  39. data/sig/nats/io/jetstream/js.rbs +27 -0
  40. data/sig/nats/io/jetstream/manager.rbs +33 -0
  41. data/sig/nats/io/jetstream/msg/ack.rbs +35 -0
  42. data/sig/nats/io/jetstream/msg/ack_methods.rbs +25 -0
  43. data/sig/nats/io/jetstream/msg/metadata.rbs +15 -0
  44. data/sig/nats/io/jetstream/msg.rbs +6 -0
  45. data/sig/nats/io/jetstream/pull_subscription.rbs +14 -0
  46. data/sig/nats/io/jetstream/push_subscription.rbs +7 -0
  47. data/sig/nats/io/jetstream.rbs +15 -0
  48. data/sig/nats/io/kv/api.rbs +8 -0
  49. data/sig/nats/io/kv/bucket_status.rbs +17 -0
  50. data/sig/nats/io/kv/errors.rbs +30 -0
  51. data/sig/nats/io/kv/manager.rbs +11 -0
  52. data/sig/nats/io/kv.rbs +39 -0
  53. data/sig/nats/io/msg.rbs +14 -0
  54. data/sig/nats/io/parser.rbs +32 -0
  55. data/sig/nats/io/subscription.rbs +33 -0
  56. data/sig/nats/io/version.rbs +9 -0
  57. data/sig/nats/nuid.rbs +32 -0
  58. metadata +68 -5
  59. data/lib/nats/io/js.rb +0 -1434
@@ -0,0 +1,8 @@
1
+ module NATS
2
+ class KeyValue
3
+ module API
4
+ class KeyValueConfig < Struct[untyped]
5
+ end
6
+ end
7
+ end
8
+ 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
@@ -0,0 +1,11 @@
1
+ module NATS
2
+ class KeyValue
3
+ module Manager
4
+ def key_value: (String) -> NATS::KeyValue
5
+
6
+ def create_key_value: (NATS::KeyValue::API::KeyValueConfig) -> NATS::KeyValue
7
+
8
+ def delete_key_value: (String) -> bool
9
+ end
10
+ end
11
+ end
@@ -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
@@ -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
@@ -0,0 +1,9 @@
1
+ module NATS
2
+ module IO
3
+ VERSION: String
4
+
5
+ LANG: String
6
+
7
+ Protocol: Integer
8
+ end
9
+ 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: 2.2.0
4
+ version: 2.3.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: 2022-10-01 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2023-09-09 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,17 +32,66 @@ executables: []
18
32
  extensions: []
19
33
  extra_rdoc_files: []
20
34
  files:
35
+ - LICENSE
36
+ - README.md
21
37
  - lib/nats.rb
22
38
  - lib/nats/client.rb
23
39
  - lib/nats/io/client.rb
24
40
  - lib/nats/io/errors.rb
25
- - lib/nats/io/js.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
26
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
27
61
  - lib/nats/io/msg.rb
28
62
  - lib/nats/io/parser.rb
63
+ - lib/nats/io/rails.rb
29
64
  - lib/nats/io/subscription.rb
30
65
  - lib/nats/io/version.rb
66
+ - lib/nats/io/websocket.rb
31
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
32
95
  homepage: https://nats.io
33
96
  licenses:
34
97
  - Apache-2.0
@@ -48,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
111
  - !ruby/object:Gem::Version
49
112
  version: '0'
50
113
  requirements: []
51
- rubygems_version: 3.3.3
114
+ rubygems_version: 3.4.1
52
115
  signing_key:
53
116
  specification_version: 4
54
117
  summary: NATS is an open-source, high-performance, lightweight cloud messaging system.