forked from flynn/flynn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackend.go
58 lines (46 loc) · 1.01 KB
/
backend.go
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
52
53
54
55
56
57
58
package main
import (
"io"
"net"
"github.com/flynn/flynn/host/types"
)
type AttachRequest struct {
Job *host.ActiveJob
Logs bool
Stream bool
Height uint16
Width uint16
Attached chan struct{}
Stdout io.WriteCloser
Stderr io.WriteCloser
InitLog io.WriteCloser
Stdin io.Reader
}
type Backend interface {
Run(*host.Job, *RunConfig) error
Stop(string) error
Signal(string, int) error
ResizeTTY(id string, height, width uint16) error
Attach(*AttachRequest) error
Cleanup() error
UnmarshalState(map[string]*host.ActiveJob, map[string][]byte, []byte) error
ConfigureNetworking(strategy NetworkStrategy, job string) (*NetworkInfo, error)
}
type RunConfig struct {
IP net.IP
ManifestID string
}
type NetworkInfo struct {
BridgeAddr string
Nameservers []string
}
type JobStateSaver interface {
MarshalJobState(jobID string) ([]byte, error)
}
type StateSaver interface {
MarshalGlobalState() ([]byte, error)
}
type NetworkStrategy int
const (
NetworkStrategyFlannel NetworkStrategy = iota
)