routemaster-drain 3.6.2 → 3.6.3
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/CHANGELOG.md +6 -0
- data/lib/routemaster/drain.rb +1 -1
- data/lib/routemaster/middleware/authenticate.rb +3 -3
- data/lib/routemaster/middleware/cache.rb +4 -4
- data/lib/routemaster/middleware/dirty.rb +2 -2
- data/lib/routemaster/middleware/expire_cache.rb +2 -2
- data/lib/routemaster/middleware/filter.rb +3 -3
- data/lib/routemaster/middleware/metrics.rb +3 -3
- data/lib/routemaster/middleware/parse.rb +1 -1
- data/lib/routemaster/middleware/response_caching.rb +3 -3
- data/lib/routemaster/middleware/root_post_only.rb +1 -1
- data/lib/routemaster/middleware/siphon.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68cd91502559ade561ad65e6440cd1609134a380
|
|
4
|
+
data.tar.gz: d9c8c31b7d24f5d56f831b49a42bcf1e09c86a43
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9250edbe5107293bab6a4b5ec81eaa61b6e35483223c2af4548b1dce04afc7948c010092fb3dd831b11947ce463700702a1586228f3c110d2c7407bdbb535b4f
|
|
7
|
+
data.tar.gz: 8ed05bfc0b1cc2d39353612f18a3f123c13298c222cf77c25ba9873e43eb9f8002091e5eb5a0e8e4f25f4286947b56fa6e36182418fa4e8ad3f9c67a4087126a
|
data/CHANGELOG.md
CHANGED
data/lib/routemaster/drain.rb
CHANGED
|
@@ -16,10 +16,10 @@ module Routemaster
|
|
|
16
16
|
class Authenticate
|
|
17
17
|
include Wisper::Publisher
|
|
18
18
|
|
|
19
|
-
#
|
|
20
|
-
def initialize(app,
|
|
19
|
+
# options[:uuid] [Enumerable] a set of accepted authentication tokens
|
|
20
|
+
def initialize(app, options = {})
|
|
21
21
|
@app = app
|
|
22
|
-
@uuid = uuid
|
|
22
|
+
@uuid = options.fetch(:uuid) { Config.drain_tokens }
|
|
23
23
|
|
|
24
24
|
unless @uuid.kind_of?(String) || @uuid.kind_of?(Enumerable)
|
|
25
25
|
raise ArgumentError, ':uuid must be a String or Enumerable'
|
|
@@ -7,11 +7,11 @@ require 'routemaster/event_index'
|
|
|
7
7
|
module Routemaster
|
|
8
8
|
module Middleware
|
|
9
9
|
class Cache
|
|
10
|
-
def initialize(app,
|
|
10
|
+
def initialize(app, options = {})
|
|
11
11
|
@app = app
|
|
12
|
-
@cache = cache
|
|
13
|
-
@client = client
|
|
14
|
-
@queue = queue
|
|
12
|
+
@cache = options.fetch(:cache) { Routemaster::Cache.new }
|
|
13
|
+
@client = options.fetch(:client) { Routemaster::Jobs::Client.new }
|
|
14
|
+
@queue = options.fetch(:queue) { Config.queue_name }
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def call(env)
|
|
@@ -11,9 +11,9 @@ module Routemaster
|
|
|
11
11
|
# The dirty map is passed as `:map` to the constructor and must respond to
|
|
12
12
|
# `#mark` (like `Routemaster::Dirty::Map`).
|
|
13
13
|
class Dirty
|
|
14
|
-
def initialize(app,
|
|
14
|
+
def initialize(app, options = {})
|
|
15
15
|
@app = app
|
|
16
|
-
@map = dirty_map
|
|
16
|
+
@map = options.fetch(:dirty_map) { Routemaster::Dirty::Map.new }
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def call(env)
|
|
@@ -3,9 +3,9 @@ require 'routemaster/cache'
|
|
|
3
3
|
module Routemaster
|
|
4
4
|
module Middleware
|
|
5
5
|
class ExpireCache
|
|
6
|
-
def initialize(app,
|
|
6
|
+
def initialize(app, options = {})
|
|
7
7
|
@app = app
|
|
8
|
-
@cache = cache
|
|
8
|
+
@cache = options.fetch(:cache) { Routemaster::Cache.new }
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def call(env)
|
|
@@ -7,11 +7,11 @@ module Routemaster
|
|
|
7
7
|
#
|
|
8
8
|
# Will use `Routemaster::Dirty::Filter` by default.
|
|
9
9
|
class Filter
|
|
10
|
-
#
|
|
10
|
+
# options[:filter] [Routemaster::Dirty::Filter] an event filter (optional;
|
|
11
11
|
# will be created using the `redis` and `expiry` options if not provided)
|
|
12
|
-
def initialize(app,
|
|
12
|
+
def initialize(app, options = {})
|
|
13
13
|
@app = app
|
|
14
|
-
@filter = filter
|
|
14
|
+
@filter = options.fetch(:filter) { Routemaster::Dirty::Filter.new }
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def call(env)
|
|
@@ -3,10 +3,10 @@ module Routemaster
|
|
|
3
3
|
class Metrics
|
|
4
4
|
INTERACTION_KEY = 'api_client'.freeze
|
|
5
5
|
|
|
6
|
-
def initialize(app,
|
|
6
|
+
def initialize(app, options = {})
|
|
7
7
|
@app = app
|
|
8
|
-
@client = client
|
|
9
|
-
@source_peer = source_peer
|
|
8
|
+
@client = options[:client]
|
|
9
|
+
@source_peer = options[:source_peer]
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def call(request_env)
|
|
@@ -10,11 +10,11 @@ module Routemaster
|
|
|
10
10
|
VERSION_REGEX = /application\/json;v=(?<version>\S*)/
|
|
11
11
|
RESPONSE_CACHING_OPT_HEADER = 'X-routemaster_drain.opt_cache'.freeze
|
|
12
12
|
|
|
13
|
-
def initialize(app,
|
|
13
|
+
def initialize(app, options = {})
|
|
14
14
|
@app = app
|
|
15
|
-
@cache = cache
|
|
15
|
+
@cache = options.fetch(:cache) { Config.cache_redis }
|
|
16
16
|
@expiry = Config.cache_expiry
|
|
17
|
-
@listener = listener
|
|
17
|
+
@listener = options[:listener]
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def call(env)
|
|
@@ -6,9 +6,9 @@ module Routemaster
|
|
|
6
6
|
#
|
|
7
7
|
# Topic handlers are initialized with the full event payload and must respond to `#call`
|
|
8
8
|
class Siphon
|
|
9
|
-
def initialize(app,
|
|
9
|
+
def initialize(app, options = {})
|
|
10
10
|
@app = app
|
|
11
|
-
@processors = siphon_events
|
|
11
|
+
@processors = options.fetch(:siphon_events) { {} }
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def call(env)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: routemaster-drain
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.6.
|
|
4
|
+
version: 3.6.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julien Letessier
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-10-
|
|
11
|
+
date: 2018-10-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|