ndb 1.13.1 → 1.14.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b119b5260213f4d41bd979d618d119fe19b04aa0b1aab7830f1701bba3e5025b
4
- data.tar.gz: 61c945234692ee86fd1b9ceef25d25b1370578d6088d7990e02414628a1d3dd4
3
+ metadata.gz: 93cdea704230998affb631c26c1e58c25fb7780d04931dbc9a922c939f24de99
4
+ data.tar.gz: ee1d7ba1a796530dda545c5076aab587b4512cab13c47d3eba4290e19d1c992e
5
5
  SHA512:
6
- metadata.gz: 4a93c644803be3260d93e1f1d03883955a60c4cb9a0fa260549657591b3dc66f1ac3ea5969320cf040978549517702ebfaccedce41badd80883baf07e8865ca7
7
- data.tar.gz: 109b22425655f2b2a32a5566793cef55fd18937098d1b8652c28587c2db905f98335d784f7fcaba419e6095cb7f97b03f92c58da878751b76ab90aa7609e2307
6
+ metadata.gz: 845cb4a57d3637bbe59978997f123c0ece7b6bbbc39136499e5e3e315384db3a4f80b4554a7e4c1d7f61b3f36b1f6e2517023f8406307ff23f463b2ec41fa6aa
7
+ data.tar.gz: 5cb673f8fb02a3c10be40af8b084997dd12ce21aab3f09ce0ad0ca5c8fb4e2dd9b041c5f86527e56f958166ac4eab9d69f029b5b949130638e5e3eb9b386e43d
data/README.md CHANGED
@@ -54,7 +54,7 @@ Ndb::Client.new(
54
54
  )
55
55
  ```
56
56
 
57
- - The address is, in order: `url:` (the `addr` of `Ndb.connect`), `socket:`, env `NDB_URL`, then the default socket `/var/run/ndb/ndb.sock`.
57
+ - The address is, in order: `url:` (the `addr` of `Ndb.connect`), `socket:`, env `NDB_URL`, then the default socket `/run/ndb/ndb.sock`.
58
58
  - The token is `token:`, or env `NDB_TOKEN`. It goes only in the `Authorization` header. A unix socket does not need it.
59
59
  - A bad address raises `ArgumentError` at once.
60
60
  - `ready_timeout` is how long a call retries while the daemon is not ready (`not_ready`, or the socket is missing or refuses). It uses exponential backoff (50 ms up to 1 s) with jitter. A write is retried only when the daemon certainly did not process it. A read is also retried after a dropped connection. A timeout is never retried. When the deadline passes, the last error is raised.
data/lib/ndb/client.rb CHANGED
@@ -14,7 +14,7 @@ module Ndb
14
14
  # reads the answers; it has no query semantics. Ndb::Collection is the
15
15
  # friendlier layer on top of it.
16
16
  class Client
17
- DEFAULT_SOCKET = "/var/run/ndb/ndb.sock"
17
+ DEFAULT_SOCKET = "/run/ndb/ndb.sock"
18
18
 
19
19
  attr_reader :pool, :endpoint
20
20
 
data/lib/ndb/errors.rb CHANGED
@@ -68,6 +68,41 @@ module Ndb
68
68
  # attaches too many documents.
69
69
  class LookupError < Error; end
70
70
 
71
+ # The daemon refused a token for this route, or a route over TCP.
72
+ class Forbidden < Error; end
73
+
74
+ # A document, an id, a batch, a path or an index definition is not valid.
75
+ class InvalidDocument < Error; end
76
+
77
+ # A collection pattern that is not valid, a write on one, or one that
78
+ # matches too many collections.
79
+ class InvalidPattern < Error; end
80
+
81
+ # The route does not exist for a direct-mode collection.
82
+ class NotSupported < Error; end
83
+
84
+ # The blob reference is not sha256:<64 hex>.
85
+ class InvalidBlobRef < Error; end
86
+
87
+ # No route has this path, or not with this method.
88
+ class UnknownRoute < Error; end
89
+
90
+ # The group table of an aggregate is over its memory limit.
91
+ class GroupLimitExceeded < Error; end
92
+
93
+ # The body or one line is over max_line_size (or the blob limit).
94
+ class RequestTooLarge < Error; end
95
+
96
+ # The watch position is not valid.
97
+ class InvalidPosition < Error; end
98
+
99
+ # The daemon is shutting down (HTTP 503). Not retried by the client: the
100
+ # request may have been taken, unlike NotReady.
101
+ class Closed < Error; end
102
+
103
+ # A bug or a disk error in the daemon; the message is in its log.
104
+ class Internal < Error; end
105
+
71
106
  # The daemon error code -> the Ruby class.
72
107
  CODE_TO_ERROR = {
73
108
  "unauthorized" => Unauthorized,
@@ -100,7 +135,30 @@ module Ndb
100
135
  "pitr_off" => PitrOff,
101
136
  "lookup_invalid" => LookupError,
102
137
  "lookup_unindexed" => LookupError,
103
- "lookup_too_large" => LookupError
138
+ "lookup_too_large" => LookupError,
139
+ "invalid_pipeline" => InvalidQuery,
140
+ "forbidden" => Forbidden,
141
+ "invalid_doc" => InvalidDocument,
142
+ "missing_id" => InvalidDocument,
143
+ "invalid_id" => InvalidDocument,
144
+ "immutable_id" => InvalidDocument,
145
+ "invalid_batch" => InvalidDocument,
146
+ "invalid_path" => InvalidDocument,
147
+ "invalid_index" => InvalidDocument,
148
+ "invalid_pattern" => InvalidPattern,
149
+ "pattern_read_only" => InvalidPattern,
150
+ "pattern_too_wide" => InvalidPattern,
151
+ "not_supported" => NotSupported,
152
+ "invalid_blob_ref" => InvalidBlobRef,
153
+ "unknown_route" => UnknownRoute,
154
+ "method_not_allowed" => UnknownRoute,
155
+ "group_limit_exceeded" => GroupLimitExceeded,
156
+ "request_too_large" => RequestTooLarge,
157
+ "line_too_large" => RequestTooLarge,
158
+ "invalid_position" => InvalidPosition,
159
+ "closed" => Closed,
160
+ "stopping" => Closed,
161
+ "internal" => Internal
104
162
  }.freeze
105
163
 
106
164
  def self.error_for(code, message, status)
data/lib/ndb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ndb
4
- VERSION = "1.13.1"
4
+ VERSION = "1.14.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ndb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.1
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thadeu
@@ -26,11 +26,12 @@ files:
26
26
  - lib/ndb/errors.rb
27
27
  - lib/ndb/id.rb
28
28
  - lib/ndb/version.rb
29
- homepage: https://github.com/thadeu/ndb
29
+ homepage: https://ndb.clowk.in
30
30
  licenses:
31
31
  - MIT
32
32
  metadata:
33
- homepage_uri: https://github.com/thadeu/ndb
33
+ homepage_uri: https://ndb.clowk.in
34
+ documentation_uri: https://ndb.clowk.in/clients/ruby
34
35
  source_code_uri: https://github.com/thadeu/ndb/tree/main/sdk/ruby
35
36
  changelog_uri: https://github.com/thadeu/ndb/blob/main/CHANGELOG.md
36
37
  bug_tracker_uri: https://github.com/thadeu/ndb/issues