blob: c4c6809627accf23ff2ac9242aabd9a4b8261b24 (
plain)
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
|
/*
* Copyright (c) 2017-2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
// File matcher/timeoutmatcher.go provides TimeoutMatcher structure.
// It implements Matcher interface and it should be used for handling timeout
// events caused by expiration of requests' job timeout.
package matcher
import (
. "git.tizen.org/tools/boruta"
)
// TimeoutMatcher implements Matcher interface for handling running requests
// timeout.
type TimeoutMatcher struct {
Matcher
// requests provides internal boruta access to requests.
requests RequestsManager
}
// NewTimeoutMatcher creates a new TimeoutMatcher structure.
func NewTimeoutMatcher(r RequestsManager) *TimeoutMatcher {
return &TimeoutMatcher{
requests: r,
}
}
// Notify implements Matcher interface. This method reacts to events passed to
// matcher. Close method is called on RequestsManager for each request.
// Some of the cases might be invalid, because the request's state has been changed
// to DONE or FAILED. Verification of closing conditions is done inside Close method.
func (m TimeoutMatcher) Notify(out []ReqID) {
for _, r := range out {
m.requests.Close(r)
}
}
|