summaryrefslogtreecommitdiff
path: root/plugins/jobs/oooold/broker/beanstalk/job.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jobs/oooold/broker/beanstalk/job.go')
-rw-r--r--plugins/jobs/oooold/broker/beanstalk/job.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/jobs/oooold/broker/beanstalk/job.go b/plugins/jobs/oooold/broker/beanstalk/job.go
new file mode 100644
index 00000000..fd9c8c3c
--- /dev/null
+++ b/plugins/jobs/oooold/broker/beanstalk/job.go
@@ -0,0 +1,24 @@
+package beanstalk
+
+import (
+ "bytes"
+ "encoding/gob"
+ "github.com/spiral/jobs/v2"
+)
+
+func pack(j *jobs.Job) ([]byte, error) {
+ b := new(bytes.Buffer)
+ err := gob.NewEncoder(b).Encode(j)
+ if err != nil {
+ return nil, err
+ }
+
+ return b.Bytes(), nil
+}
+
+func unpack(data []byte) (*jobs.Job, error) {
+ j := &jobs.Job{}
+ err := gob.NewDecoder(bytes.NewBuffer(data)).Decode(j)
+
+ return j, err
+}