MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / NewRuntimeInfo

Function NewRuntimeInfo

pkg/controller/rtctrl/runtimeinfo.go:26–49  ·  view source on GitHub ↗
(params *NewRuntimeParameters)

Source from the content-addressed store, hash-verified

24)
25
26func NewRuntimeInfo(params *NewRuntimeParameters) *RuntimeInfo {
27 ri := &RuntimeInfo{
28 RuntimeID: params.RuntimeID,
29 LastAccessTime: time.Now(),
30 LastLivenessTime: time.Now(),
31 ConcurrentMode: params.ConcurrentMode,
32 DefaultConcurrentMode: params.ConcurrentMode,
33 Abnormal: false,
34 State: RuntimeStateClosed,
35 runtimeRunChan: make(chan struct{}),
36 runtimeStopChan: make(chan struct{}),
37 runtimeStoppingChan: make(chan struct{}),
38 requestChan: make(chan *InvokeRequest, 100), // TODO: length is a magic num
39 httpClient: nil,
40 runtimeWaitGroup: sync.WaitGroup{},
41 WaitRuntimeAliveTimeout: params.WaitRuntimeAliveTimeout,
42 WithStreamMode: params.StreamMode,
43 Resource: params.Resource,
44 }
45 if params.IsFrozen {
46 ri.SetState(RuntimeStateMerged)
47 }
48 return ri
49}
50
51func (info *RuntimeInfo) SetState(s RuntimeStateType) {
52 logs.V(3).Infof("update runtime %s state %s to %s", info.RuntimeID, info.State, s)

Callers 7

TestRequestInfoFunction · 0.85
TestInvokeDoneFunction · 0.85
NewRuntimeMethod · 0.85
TestRuntimeInfoFunction · 0.85
TestHandleRuntimeInitFunction · 0.85
TestHandleInvokeDoneFunction · 0.85

Calls 1

SetStateMethod · 0.95

Tested by 6

TestRequestInfoFunction · 0.68
TestInvokeDoneFunction · 0.68
TestRuntimeInfoFunction · 0.68
TestHandleRuntimeInitFunction · 0.68
TestHandleInvokeDoneFunction · 0.68