diff options
author | Valery Piashchynski <[email protected]> | 2022-01-12 17:16:33 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2022-01-12 17:16:33 +0300 |
commit | 7627cb3ba0fd42592ed36bdf4de5c5af1ffa9f18 (patch) | |
tree | 62ce8ef32f63876187b773faf32b2b325458b104 | |
parent | a191eac78092dda89dbcd19c7a3a171f6aafb71a (diff) | |
parent | a3077cf70c061234960b0f6b8a8c8e99ac2254b7 (diff) |
[#890]: feat(protocol): add codec type to the protocol structurev2.7.0
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 11 | ||||
-rwxr-xr-x | internal/protocol.go | 2 | ||||
-rwxr-xr-x | payload/payload.go | 3 | ||||
-rwxr-xr-x | worker/sync_worker.go | 2 |
6 files changed, 11 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bc56a72..f99bbf18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - ✏️ RR `workers pool`, `worker`, `worker_watcher` now has their own log levels. `stderr/stdout` logged as before at the `info` log level. All other messages moved to the `debug` log level except a few events from the `worker_watcher` when RR can't allocate the new worker which are moved to the `warn`. - ✏️ Use the common logger for the whole roadrunner-sdk and roadrunner-plugins. +- ✏️ Add `codec` field to the `protocol` structure **[internal change]**. ## 🩹 Fixes: @@ -8,7 +8,7 @@ require ( github.com/shirou/gopsutil v3.21.11+incompatible // spiral github.com/spiral/errors v1.0.12 - github.com/spiral/goridge/v3 v3.2.4 + github.com/spiral/goridge/v3 v3.2.6 // spiral github.com/stretchr/testify v1.7.0 go.uber.org/multierr v1.7.0 @@ -30,8 +30,8 @@ github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKl github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/spiral/errors v1.0.12 h1:38Waf8ZL/Xvxg4HTYGmrUbvi7TCHivmuatNQZlBhQ8s= github.com/spiral/errors v1.0.12/go.mod h1:j5UReqxZxfkwXkI9mFY87VhEXcXmSg7kAk5Sswy1eEA= -github.com/spiral/goridge/v3 v3.2.4 h1:Octzn0kgpQY10vQhrf0a5RlzCVW1lIEuR6/IGYp0BW4= -github.com/spiral/goridge/v3 v3.2.4/go.mod h1:a6qAtZy+FBaPj/76GweHj6SkgIr+oRVgW5p4e5vLZF4= +github.com/spiral/goridge/v3 v3.2.6 h1:RUO02r/TX0KWAvIiqc3/i5i6v34onf0BadL5TNQpTWY= +github.com/spiral/goridge/v3 v3.2.6/go.mod h1:a6qAtZy+FBaPj/76GweHj6SkgIr+oRVgW5p4e5vLZF4= github.com/spiral/tcplisten v1.0.0 h1:dII3R20Xslll6Uk60ac1JCn9zQwfwbt88CLrs3OryZg= github.com/spiral/tcplisten v1.0.0/go.mod h1:+anIsZh2ZYw2EogG2pO1yEZKcGN7lEf41hUQilctYJo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -51,14 +51,11 @@ github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.11-0.20210813005559-691160354723 h1:sHOAIxRGBp443oHZIPB+HsUGaksVCXVQENPxwTfQdH4= -go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= -go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI= -go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go.uber.org/zap v1.20.0 h1:N4oPlghZwYG55MlU6LXk/Zp00FVNE9X9wrYO8CEs4lc= go.uber.org/zap v1.20.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -79,8 +76,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220111092808-5a964db01320 h1:0jf+tOCoZ3LyutmCOWpVni1chK4VfFLhRsDK7MhqGRY= golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/internal/protocol.go b/internal/protocol.go index c5916f22..cefd685d 100755 --- a/internal/protocol.go +++ b/internal/protocol.go @@ -36,7 +36,7 @@ func SendControl(rl relay.Relay, payload interface{}) error { defer putFrame(fr) fr.WriteVersion(fr.Header(), frame.VERSION_1) - fr.WriteFlags(fr.Header(), frame.CONTROL) + fr.WriteFlags(fr.Header(), frame.CONTROL, frame.CODEC_JSON) if data, ok := payload.([]byte); ok { // check if payload no more that 4Gb diff --git a/payload/payload.go b/payload/payload.go index e1e45ac1..a475bc75 100755 --- a/payload/payload.go +++ b/payload/payload.go @@ -12,6 +12,9 @@ type Payload struct { // body contains binary payload to be processed by WorkerProcess. Body []byte + + // Type of codec used to decode/encode payload + Codec byte } // String returns payload body as string diff --git a/worker/sync_worker.go b/worker/sync_worker.go index e3e85ba6..6ece0ad7 100755 --- a/worker/sync_worker.go +++ b/worker/sync_worker.go @@ -162,6 +162,7 @@ func (tw *SyncWorkerImpl) execPayload(p *payload.Payload) (*payload.Payload, err // can be 0 here fr.WriteVersion(fr.Header(), frame.VERSION_1) + fr.WriteFlags(fr.Header(), p.Codec) // obtain a buffer buf := tw.get() @@ -207,6 +208,7 @@ func (tw *SyncWorkerImpl) execPayload(p *payload.Payload) (*payload.Payload, err } pld := &payload.Payload{ + Codec: flags, Body: make([]byte, len(frameR.Payload()[options[0]:])), Context: make([]byte, len(frameR.Payload()[:options[0]])), } |