async-container 0.22.0 → 0.23.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/async/container/notify/log.rb +52 -0
- data/lib/async/container/notify/server.rb +1 -0
- data/lib/async/container/notify.rb +2 -0
- data/lib/async/container/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83778c10be3ccd8ed8b61d607d5e742f2b727f01a2ee16149cf298a70585a083
|
4
|
+
data.tar.gz: 14eb47ac328d93b39517b74210f6a4d26b22afa13aefa42df105e2d9e55d16b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc053221b626ecfbec43f512442547d151737dc8894efb15a4ab53e9f651d5597162206dd1260c43a6d5a0599d39edb2bd37cb21ab0a3c415ee44b9f42b68117
|
7
|
+
data.tar.gz: 36ae31abb21e0ee9bc7db47fc881de4ba2ddd3b0aa13b8878ae639cf96e8c56b0bfb561cb34074ee2d10b65e8bcdb5bd4e678d48a7bf1d9527774a525d43eb98
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2020-2024, by Samuel Williams.
|
5
|
+
|
6
|
+
require_relative "client"
|
7
|
+
require "socket"
|
8
|
+
|
9
|
+
module Async
|
10
|
+
module Container
|
11
|
+
module Notify
|
12
|
+
class Log < Client
|
13
|
+
# The name of the environment variable which contains the path to the notification socket.
|
14
|
+
NOTIFY_LOG = "NOTIFY_LOG"
|
15
|
+
|
16
|
+
# Open a notification client attached to the current {NOTIFY_LOG} if possible.
|
17
|
+
def self.open!(environment = ENV)
|
18
|
+
if path = environment.delete(NOTIFY_LOG)
|
19
|
+
self.new(path)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Initialize the notification client.
|
24
|
+
# @parameter path [String] The path to the UNIX socket used for sending messages to the process manager.
|
25
|
+
def initialize(path)
|
26
|
+
@path = path
|
27
|
+
end
|
28
|
+
|
29
|
+
# @attribute [String] The path to the UNIX socket used for sending messages to the controller.
|
30
|
+
attr :path
|
31
|
+
|
32
|
+
# Send the given message.
|
33
|
+
# @parameter message [Hash]
|
34
|
+
def send(**message)
|
35
|
+
data = JSON.dump(message)
|
36
|
+
|
37
|
+
File.open(@path, "a") do |file|
|
38
|
+
file.puts(data)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Send the specified error.
|
43
|
+
# `sd_notify` requires an `errno` key, which defaults to `-1` to indicate a generic error.
|
44
|
+
def error!(text, **message)
|
45
|
+
message[:errno] ||= -1
|
46
|
+
|
47
|
+
super
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -6,6 +6,7 @@
|
|
6
6
|
require_relative "notify/pipe"
|
7
7
|
require_relative "notify/socket"
|
8
8
|
require_relative "notify/console"
|
9
|
+
require_relative "notify/log"
|
9
10
|
|
10
11
|
module Async
|
11
12
|
module Container
|
@@ -18,6 +19,7 @@ module Async
|
|
18
19
|
@client ||= (
|
19
20
|
Pipe.open! ||
|
20
21
|
Socket.open! ||
|
22
|
+
Log.open! ||
|
21
23
|
Console.open!
|
22
24
|
)
|
23
25
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-container
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -40,7 +40,7 @@ cert_chain:
|
|
40
40
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
41
41
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
42
42
|
-----END CERTIFICATE-----
|
43
|
-
date: 2025-02-
|
43
|
+
date: 2025-02-27 00:00:00.000000000 Z
|
44
44
|
dependencies:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: async
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/async/container/notify.rb
|
74
74
|
- lib/async/container/notify/client.rb
|
75
75
|
- lib/async/container/notify/console.rb
|
76
|
+
- lib/async/container/notify/log.rb
|
76
77
|
- lib/async/container/notify/pipe.rb
|
77
78
|
- lib/async/container/notify/server.rb
|
78
79
|
- lib/async/container/notify/socket.rb
|
metadata.gz.sig
CHANGED
Binary file
|