Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
scheduler.h
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 
16 #ifndef STATESTORE_SCHEDULER_H
17 #define STATESTORE_SCHEDULER_H
18 
19 #include <vector>
20 #include <string>
21 
22 #include "common/global-types.h"
23 #include "common/status.h"
25 #include "util/container-util.h"
26 #include "gen-cpp/Types_types.h" // for TNetworkAddress
27 #include "gen-cpp/StatestoreService_types.h"
28 #include "gen-cpp/PlanNodes_types.h"
29 #include "gen-cpp/Frontend_types.h"
30 #include "gen-cpp/ImpalaInternalService_types.h"
31 #include "gen-cpp/ResourceBrokerService_types.h"
32 
33 namespace impala {
34 
40 class Scheduler {
41  public:
42  virtual ~Scheduler() { }
43 
45  typedef std::vector<TBackendDescriptor> BackendList;
46 
50  virtual Status GetBackends(const std::vector<TNetworkAddress>& data_locations,
51  BackendList* backends) = 0;
52 
55  virtual Status GetBackend(const TNetworkAddress& data_location,
56  TBackendDescriptor* backend) = 0;
57 
59  virtual bool HasLocalBackend(const TNetworkAddress& data_location) = 0;
60 
62  virtual void GetAllKnownBackends(BackendList* backends) = 0;
63 
69  virtual Status Schedule(Coordinator* coord, QuerySchedule* schedule) = 0;
70 
72  virtual Status Release(QuerySchedule* schedule) = 0;
73 
77  virtual void HandlePreemptedReservation(const TUniqueId& reservation_id) = 0;
78 
82  virtual void HandlePreemptedResource(const TUniqueId& client_resource_id) = 0;
83 
87  virtual void HandleLostResource(const TUniqueId& client_resource_id) = 0;
88 
91  virtual Status Init() = 0;
92 
93 };
94 
95 }
96 
97 #endif
virtual Status GetBackend(const TNetworkAddress &data_location, TBackendDescriptor *backend)=0
virtual bool HasLocalBackend(const TNetworkAddress &data_location)=0
Return true if there is a backend located on the given data_location.
static list< string > backends
virtual Status Init()=0
virtual Status GetBackends(const std::vector< TNetworkAddress > &data_locations, BackendList *backends)=0
virtual ~Scheduler()
Definition: scheduler.h:42
virtual void HandleLostResource(const TUniqueId &client_resource_id)=0
virtual Status Schedule(Coordinator *coord, QuerySchedule *schedule)=0
virtual void HandlePreemptedResource(const TUniqueId &client_resource_id)=0
virtual void HandlePreemptedReservation(const TUniqueId &reservation_id)=0
std::vector< TBackendDescriptor > BackendList
List of server descriptors.
Definition: scheduler.h:45
virtual Status Release(QuerySchedule *schedule)=0
Releases the reserved resources (if any) from the given schedule.
virtual void GetAllKnownBackends(BackendList *backends)=0
Return a list of all backends known to the scheduler.