Debian Codegraph @

api/v0/scheduler/testing.go

raw symbols SCIP
1 package scheduler
2
3 import (
4 "github.com/gogo/protobuf/proto"
5 mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
6 "github.com/mesos/mesos-go/api/v0/upid"
7 "golang.org/x/net/context"
8 )
9
10 type TestDriver struct {
11 *MesosSchedulerDriver
12 }
13
14 func (t *TestDriver) SetConnected(b bool) {
15 t.eventLock.Lock()
16 defer t.eventLock.Unlock()
17 t.connected = b
18 }
19
20 func (t *TestDriver) Started() <-chan struct{} {
21 return t.started
22 }
23
24 func (t *TestDriver) Stopped() <-chan struct{} {
25 return t.stopCh
26 }
27
28 func (t *TestDriver) Done() <-chan struct{} {
29 return t.done
30 }
31
32 func (t *TestDriver) Framework() *mesos.FrameworkInfo {
33 return t.frameworkInfo
34 }
35
36 func (t *TestDriver) UPID() *upid.UPID {
37 return t.self
38 }
39
40 func (t *TestDriver) MasterPID() *upid.UPID {
41 return t.masterPid
42 }
43
44 func (t *TestDriver) Fatal(ctx context.Context, msg string) {
45 t.eventLock.Lock()
46 defer t.eventLock.Unlock()
47 t.fatal(ctx, msg)
48 }
49
50 func (t *TestDriver) OnDispatch(f func(ctx context.Context, upid *upid.UPID, msg proto.Message) error) {
51 t.dispatch = f
52 }
53
54 func (t *TestDriver) HandleMasterChanged(ctx context.Context, from *upid.UPID, msg proto.Message) {
55 t.eventLock.Lock()
56 defer t.eventLock.Unlock()
57 t.handleMasterChanged(ctx, from, msg)
58 }
59
60 func (t *TestDriver) CacheOffer(offer *mesos.Offer, pid *upid.UPID) {
61 t.cache.putOffer(offer, pid)
62 }
63
64 func (t *TestDriver) Context() context.Context {
65 return t.context()
66 }
67
68 func (t *TestDriver) FrameworkRegistered(ctx context.Context, from *upid.UPID, msg proto.Message) {
69 t.eventLock.Lock()
70 defer t.eventLock.Unlock()
71 t.frameworkRegistered(ctx, from, msg)
72 }
73
74 func (t *TestDriver) FrameworkReregistered(ctx context.Context, from *upid.UPID, msg proto.Message) {
75 t.eventLock.Lock()
76 defer t.eventLock.Unlock()
77 t.frameworkReregistered(ctx, from, msg)
78 }