summaryrefslogtreecommitdiff
path: root/matcher/requestsmanager.go
diff options
context:
space:
mode:
authorLukasz Wojciechowski <l.wojciechow@partner.samsung.com>2017-10-06 19:49:32 +0200
committerLukasz Wojciechowski <l.wojciechow@partner.samsung.com>2018-04-27 17:34:20 +0200
commit1fceedd42bc6f61b2b151503421b3bc04e989b49 (patch)
tree6cb42c0bdfe905ed1481d6671cf88d1b4b2ab177 /matcher/requestsmanager.go
parent86b502f77e01973d9c3e98c8b6c3e0591b7880e7 (diff)
downloadboruta-1fceedd42bc6f61b2b151503421b3bc04e989b49.tar.gz
boruta-1fceedd42bc6f61b2b151503421b3bc04e989b49.tar.bz2
boruta-1fceedd42bc6f61b2b151503421b3bc04e989b49.zip
Add RequestsManager interface
RequestsManager interface defines API for taking actions triggered by matcher events on requests structures. The mock implementation of interface is provided in matcher package. It is generated using mockgen command: mockgen -package matcher \ -destination=matcher/requestsmanager_mock_test.go \ -write_package_comment=false \ git.tizen.org/tools/boruta/matcher RequestsManager Change-Id: Idbf83988dba4cfa761dbfe8cae0a33d0a39245ac Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Diffstat (limited to 'matcher/requestsmanager.go')
-rw-r--r--matcher/requestsmanager.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/matcher/requestsmanager.go b/matcher/requestsmanager.go
new file mode 100644
index 0000000..4920166
--- /dev/null
+++ b/matcher/requestsmanager.go
@@ -0,0 +1,51 @@
+/*
+ * 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/requestsmanager.go defines RequestManager interface with API
+// for taking actions triggered by matcher events on requests structures.
+
+package matcher
+
+import (
+ "time"
+
+ . "git.tizen.org/tools/boruta"
+)
+
+// RequestsManager interface defines API for internal boruta management of requests.
+type RequestsManager interface {
+ // InitIteration starts iteration over requests pending in queue.
+ // Method returns error if iterations are already started and have not been
+ // terminated with TerminateIteration()
+ InitIteration() error
+ // TerminateIteration finishes iterating over requests formerly started with InitIteration.
+ TerminateIteration()
+ // Next gets next ID from request queue.
+ // Method returns {ID, true} if there is pending request
+ // or {ReqID(0), false} if queue's end has been reached.
+ Next() (ReqID, bool)
+ // VerifyIfReady checks if the request is ready to be run on worker.
+ VerifyIfReady(ReqID, time.Time) bool
+ // Get retrieves full request information or error if no request is found.
+ Get(ReqID) (ReqInfo, error)
+ // Timeout sets request to TIMEOUT state after Deadline time is exceeded.
+ Timeout(ReqID) error
+ // Close closes request setting it in DONE state, closing job
+ // and releasing worker after run time of the request has been exceeded.
+ Close(ReqID) error
+ // Run starts job performing the request on the worker.
+ Run(ReqID, WorkerUUID) error
+}