summaryrefslogtreecommitdiff
path: root/commands.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2017-12-26 19:14:53 +0300
committerWolfy-J <[email protected]>2017-12-26 19:14:53 +0300
commite229d83dea4bbe9d0cfe6569c8fbe239690aafb9 (patch)
tree2d4887ffdb167d660b705415f0617458490d0b9f /commands.go
init
Diffstat (limited to 'commands.go')
-rw-r--r--commands.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/commands.go b/commands.go
new file mode 100644
index 00000000..600af16a
--- /dev/null
+++ b/commands.go
@@ -0,0 +1,27 @@
+package roadrunner
+
+import (
+ "encoding/json"
+ "github.com/spiral/goridge"
+)
+
+// TerminateCommand must stop underlying process.
+type TerminateCommand struct {
+ Terminate bool `json:"terminate"`
+}
+
+// PidCommand send greeting message between processes in json format.
+type PidCommand struct {
+ Pid int `json:"pid"`
+ Parent int `json:"parent,omitempty"`
+}
+
+// sends control message via relay using JSON encoding
+func sendCommand(rl goridge.Relay, command interface{}) error {
+ bin, err := json.Marshal(command)
+ if err != nil {
+ return err
+ }
+
+ return rl.Send(bin, goridge.PayloadControl)
+} \ No newline at end of file