File: calls.go

package info (click to toggle)
golang-github-mesos-mesos-go 0.0.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 11,724 kB
  • sloc: makefile: 163
file content (51 lines) | stat: -rw-r--r-- 1,275 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package calls

import (
	"github.com/mesos/mesos-go/api/v1/lib"
	"github.com/mesos/mesos-go/api/v1/lib/executor"
)

// Framework sets a executor.Call's FrameworkID
func Framework(id string) executor.CallOpt {
	return func(c *executor.Call) {
		c.FrameworkID = mesos.FrameworkID{Value: id}
	}
}

// Executor sets a executor.Call's ExecutorID
func Executor(id string) executor.CallOpt {
	return func(c *executor.Call) {
		c.ExecutorID = mesos.ExecutorID{Value: id}
	}
}

// Subscribe returns an executor call with the given parameters.
func Subscribe(unackdTasks []mesos.TaskInfo, unackdUpdates []executor.Call_Update) *executor.Call {
	return &executor.Call{
		Type: executor.Call_SUBSCRIBE,
		Subscribe: &executor.Call_Subscribe{
			UnacknowledgedTasks:   unackdTasks,
			UnacknowledgedUpdates: unackdUpdates,
		},
	}
}

// Update returns an executor call with the given parameters.
func Update(status mesos.TaskStatus) *executor.Call {
	return &executor.Call{
		Type: executor.Call_UPDATE,
		Update: &executor.Call_Update{
			Status: status,
		},
	}
}

// Message returns an executor call with the given parameters.
func Message(data []byte) *executor.Call {
	return &executor.Call{
		Type: executor.Call_MESSAGE,
		Message: &executor.Call_Message{
			Data: data,
		},
	}
}