semian 0.10.1 → 0.10.6
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/ext/semian/semian.c +5 -0
- data/ext/semian/sysv_semaphores.h +1 -1
- data/lib/semian.rb +1 -1
- data/lib/semian/grpc.rb +4 -4
- data/lib/semian/mysql2.rb +4 -4
- data/lib/semian/resource.rb +2 -2
- data/lib/semian/simple_sliding_window.rb +1 -1
- data/lib/semian/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b54ee93c46832142977d1befbd48c6e76e20992573eee798056810cfca6cc2a4
|
4
|
+
data.tar.gz: a9a3f804b0aebf6a794c085fc11fb2ea612e876e13d8d6ace6cf3fe4c095e631
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f388523a165f4325bb517d801b804a81636008afb6f0c0951be8a4b108323b7621ebf3444925befc2cfd0ac16fdbfc442cb9ec826e19e17ef9aab50769121294
|
7
|
+
data.tar.gz: 043bbc5dad551ca00ded71a4026121afbb01f22cda73d526470fe63c1077f590db1ed64449c23f2e2d6b5f735d87e89c266a638f8deff191b944eb98d1f5f361
|
data/ext/semian/semian.c
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#include "semian.h"
|
2
2
|
|
3
|
+
VALUE eSyscall, eTimeout, eInternal;
|
4
|
+
|
3
5
|
void Init_semian()
|
4
6
|
{
|
5
7
|
VALUE cSemian, cResource;
|
@@ -22,12 +24,14 @@ void Init_semian()
|
|
22
24
|
* Represents a Semian error that was caused by an underlying syscall failure.
|
23
25
|
*/
|
24
26
|
eSyscall = rb_const_get(cSemian, rb_intern("SyscallError"));
|
27
|
+
rb_global_variable(&eSyscall);
|
25
28
|
|
26
29
|
/* Document-class: Semian::TimeoutError
|
27
30
|
*
|
28
31
|
* Raised when a Semian operation timed out.
|
29
32
|
*/
|
30
33
|
eTimeout = rb_const_get(cSemian, rb_intern("TimeoutError"));
|
34
|
+
rb_global_variable(&eTimeout);
|
31
35
|
|
32
36
|
/* Document-class: Semian::InternalError
|
33
37
|
*
|
@@ -40,6 +44,7 @@ void Init_semian()
|
|
40
44
|
* the semaphore in this case.
|
41
45
|
*/
|
42
46
|
eInternal = rb_const_get(cSemian, rb_intern("InternalError"));
|
47
|
+
rb_global_variable(&eInternal);
|
43
48
|
|
44
49
|
rb_define_alloc_func(cResource, semian_resource_alloc);
|
45
50
|
rb_define_method(cResource, "initialize_semaphore", semian_resource_initialize, 5);
|
data/lib/semian.rb
CHANGED
@@ -287,7 +287,7 @@ module Semian
|
|
287
287
|
Resource.new(name, tickets: options[:tickets], quota: options[:quota], permissions: permissions, timeout: timeout)
|
288
288
|
end
|
289
289
|
|
290
|
-
def require_keys!(required
|
290
|
+
def require_keys!(required, options)
|
291
291
|
diff = required - options.keys
|
292
292
|
unless diff.empty?
|
293
293
|
raise ArgumentError, "Missing required arguments for Semian: #{diff}"
|
data/lib/semian/grpc.rb
CHANGED
@@ -79,22 +79,22 @@ module Semian
|
|
79
79
|
raw_semian_options.nil?
|
80
80
|
end
|
81
81
|
|
82
|
-
def request_response(
|
82
|
+
def request_response(*, **)
|
83
83
|
return super if disabled?
|
84
84
|
acquire_semian_resource(adapter: :grpc, scope: :request_response) { super }
|
85
85
|
end
|
86
86
|
|
87
|
-
def client_streamer(
|
87
|
+
def client_streamer(*, **)
|
88
88
|
return super if disabled?
|
89
89
|
acquire_semian_resource(adapter: :grpc, scope: :client_streamer) { super }
|
90
90
|
end
|
91
91
|
|
92
|
-
def server_streamer(
|
92
|
+
def server_streamer(*, **)
|
93
93
|
return super if disabled?
|
94
94
|
acquire_semian_resource(adapter: :grpc, scope: :server_streamer) { super }
|
95
95
|
end
|
96
96
|
|
97
|
-
def bidi_streamer(
|
97
|
+
def bidi_streamer(*, **)
|
98
98
|
return super if disabled?
|
99
99
|
acquire_semian_resource(adapter: :grpc, scope: :bidi_streamer) { super }
|
100
100
|
end
|
data/lib/semian/mysql2.rb
CHANGED
@@ -37,9 +37,9 @@ module Semian
|
|
37
37
|
DEFAULT_PORT = 3306
|
38
38
|
|
39
39
|
QUERY_WHITELIST = Regexp.union(
|
40
|
-
/\A
|
41
|
-
/\A
|
42
|
-
/\A
|
40
|
+
/\A(?:\/\*.*?\*\/)?\s*ROLLBACK/i,
|
41
|
+
/\A(?:\/\*.*?\*\/)?\s*COMMIT/i,
|
42
|
+
/\A(?:\/\*.*?\*\/)?\s*RELEASE\s+SAVEPOINT/i,
|
43
43
|
)
|
44
44
|
|
45
45
|
# The naked methods are exposed as `raw_query` and `raw_connect` for instrumentation purpose
|
@@ -116,7 +116,7 @@ module Semian
|
|
116
116
|
acquire_semian_resource(adapter: :mysql, scope: :connection) { raw_connect(*args) }
|
117
117
|
end
|
118
118
|
|
119
|
-
def acquire_semian_resource(
|
119
|
+
def acquire_semian_resource(**)
|
120
120
|
super
|
121
121
|
rescue ::Mysql2::Error => error
|
122
122
|
if error.is_a?(PingFailure) || (!error.is_a?(::Mysql2::SemianError) && error.message.match?(CONNECTION_ERROR))
|
data/lib/semian/resource.rb
CHANGED
@@ -4,8 +4,8 @@ module Semian
|
|
4
4
|
|
5
5
|
class << Semian::Resource
|
6
6
|
# Ensure that there can only be one resource of a given type
|
7
|
-
def instance(
|
8
|
-
Semian.resources[
|
7
|
+
def instance(name, **kwargs)
|
8
|
+
Semian.resources[name] ||= ProtectedResource.new(name, new(name, **kwargs), nil)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
data/lib/semian/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Francis
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-11-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake-compiler
|