Apache Mesos
allocator.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __MASTER_ALLOCATOR_MESOS_ALLOCATOR_HPP__
18 #define __MASTER_ALLOCATOR_MESOS_ALLOCATOR_HPP__
19 
21 
22 #include <process/dispatch.hpp>
23 #include <process/future.hpp>
24 #include <process/process.hpp>
25 
26 #include <stout/hashmap.hpp>
27 #include <stout/try.hpp>
28 
29 namespace mesos {
30 namespace internal {
31 namespace master {
32 namespace allocator {
33 
35 
36 // A wrapper for Process-based allocators. It redirects all function
37 // invocations to the underlying AllocatorProcess and manages its
38 // lifetime. We ensure the template parameter AllocatorProcess
39 // implements MesosAllocatorProcess by storing a pointer to it.
40 template <typename AllocatorProcess>
42 {
43 public:
44  // Factory to allow for typed tests.
46 
47  ~MesosAllocator() override;
48 
49  void initialize(
50  const mesos::allocator::Options& options,
51  const lambda::function<
52  void(const FrameworkID&,
53  const hashmap<std::string, hashmap<SlaveID, Resources>>&)>&
54  offerCallback,
55  const lambda::function<
56  void(const FrameworkID&,
58  inverseOfferCallback) override;
59 
60  void recover(
61  const int expectedAgentCount,
62  const hashmap<std::string, Quota>& quotas) override;
63 
64  void addFramework(
65  const FrameworkID& frameworkId,
66  const FrameworkInfo& frameworkInfo,
68  bool active,
69  ::mesos::allocator::FrameworkOptions&& options) override;
70 
71  void removeFramework(
72  const FrameworkID& frameworkId) override;
73 
74  void activateFramework(
75  const FrameworkID& frameworkId) override;
76 
78  const FrameworkID& frameworkId) override;
79 
80  void updateFramework(
81  const FrameworkID& frameworkId,
82  const FrameworkInfo& frameworkInfo,
83  ::mesos::allocator::FrameworkOptions&& options) override;
84 
85  void addSlave(
86  const SlaveID& slaveId,
87  const SlaveInfo& slaveInfo,
88  const std::vector<SlaveInfo::Capability>& capabilities,
90  const Resources& total,
91  const hashmap<FrameworkID, Resources>& used) override;
92 
93  void removeSlave(
94  const SlaveID& slaveId) override;
95 
96  void updateSlave(
97  const SlaveID& slave,
98  const SlaveInfo& slaveInfo,
99  const Option<Resources>& total = None(),
100  const Option<std::vector<SlaveInfo::Capability>>& capabilities = None())
101  override;
102 
103  void addResourceProvider(
104  const SlaveID& slave,
105  const Resources& total,
106  const hashmap<FrameworkID, Resources>& used) override;
107 
108  void activateSlave(
109  const SlaveID& slaveId) override;
110 
111  void deactivateSlave(
112  const SlaveID& slaveId) override;
113 
114  void updateWhitelist(
115  const Option<hashset<std::string>>& whitelist) override;
116 
117  void requestResources(
118  const FrameworkID& frameworkId,
119  const std::vector<Request>& requests) override;
120 
121  void updateAllocation(
122  const FrameworkID& frameworkId,
123  const SlaveID& slaveId,
124  const Resources& offeredResources,
125  const std::vector<ResourceConversion>& conversions) override;
126 
128  const SlaveID& slaveId,
129  const std::vector<Offer::Operation>& operations) override;
130 
132  const SlaveID& slaveId,
133  const Option<Unavailability>& unavailability) override;
134 
135  void updateInverseOffer(
136  const SlaveID& slaveId,
137  const FrameworkID& frameworkId,
138  const Option<UnavailableResources>& unavailableResources,
140  const Option<Filters>& filters) override;
141 
143  hashmap<SlaveID,
145  getInverseOfferStatuses() override;
146 
148  const SlaveID& slaveId, const Resources& resources) override;
149 
150  void recoverResources(
151  const FrameworkID& frameworkId,
152  const SlaveID& slaveId,
153  const Resources& resources,
154  const Option<Filters>& filters,
155  bool isAllocated) override;
156 
157  void suppressOffers(
158  const FrameworkID& frameworkId,
159  const std::set<std::string>& roles) override;
160 
161  void reviveOffers(
162  const FrameworkID& frameworkId,
163  const std::set<std::string>& roles) override;
164 
165  void updateQuota(
166  const std::string& role,
167  const Quota& quota) override;
168 
169  void updateWeights(
170  const std::vector<WeightInfo>& weightInfos) override;
171 
172  void pause() override;
173 
174  void resume() override;
175 
176 private:
177  MesosAllocator();
178  MesosAllocator(const MesosAllocator&); // Not copyable.
179  MesosAllocator& operator=(const MesosAllocator&); // Not assignable.
180 
182 };
183 
184 
185 // The basic interface for all Process-based allocators.
186 class MesosAllocatorProcess : public process::Process<MesosAllocatorProcess>
187 {
188 public:
190 
192 
193  // Explicitly unhide 'initialize' to silence a compiler warning
194  // from clang, since we overload below.
196 
197  virtual void initialize(
198  const mesos::allocator::Options& options,
199  const lambda::function<
200  void(const FrameworkID&,
201  const hashmap<std::string, hashmap<SlaveID, Resources>>&)>&
202  offerCallback,
203  const lambda::function<
204  void(const FrameworkID&,
206  inverseOfferCallback) = 0;
207 
208  virtual void recover(
209  const int expectedAgentCount,
210  const hashmap<std::string, Quota>& quotas) = 0;
211 
212  virtual void addFramework(
213  const FrameworkID& frameworkId,
214  const FrameworkInfo& frameworkInfo,
216  bool active,
217  ::mesos::allocator::FrameworkOptions&& options) = 0;
218 
219  virtual void removeFramework(
220  const FrameworkID& frameworkId) = 0;
221 
222  virtual void activateFramework(
223  const FrameworkID& frameworkId) = 0;
224 
225  virtual void deactivateFramework(
226  const FrameworkID& frameworkId) = 0;
227 
228  virtual void updateFramework(
229  const FrameworkID& frameworkId,
230  const FrameworkInfo& frameworkInfo,
231  ::mesos::allocator::FrameworkOptions&& options) = 0;
232 
233  virtual void addSlave(
234  const SlaveID& slaveId,
235  const SlaveInfo& slaveInfo,
236  const std::vector<SlaveInfo::Capability>& capabilities,
238  const Resources& total,
239  const hashmap<FrameworkID, Resources>& used) = 0;
240 
241  virtual void removeSlave(
242  const SlaveID& slaveId) = 0;
243 
244  virtual void updateSlave(
245  const SlaveID& slave,
246  const SlaveInfo& slaveInfo,
247  const Option<Resources>& total = None(),
248  const Option<std::vector<SlaveInfo::Capability>>&
249  capabilities = None()) = 0;
250 
251  virtual void addResourceProvider(
252  const SlaveID& slave,
253  const Resources& total,
254  const hashmap<FrameworkID, Resources>& used) = 0;
255 
256  virtual void activateSlave(
257  const SlaveID& slaveId) = 0;
258 
259  virtual void deactivateSlave(
260  const SlaveID& slaveId) = 0;
261 
262  virtual void updateWhitelist(
263  const Option<hashset<std::string>>& whitelist) = 0;
264 
265  virtual void requestResources(
266  const FrameworkID& frameworkId,
267  const std::vector<Request>& requests) = 0;
268 
269  virtual void updateAllocation(
270  const FrameworkID& frameworkId,
271  const SlaveID& slaveId,
272  const Resources& offeredResources,
273  const std::vector<ResourceConversion>& conversions) = 0;
274 
276  const SlaveID& slaveId,
277  const std::vector<Offer::Operation>& operations) = 0;
278 
279  virtual void updateUnavailability(
280  const SlaveID& slaveId,
281  const Option<Unavailability>& unavailability) = 0;
282 
283  virtual void updateInverseOffer(
284  const SlaveID& slaveId,
285  const FrameworkID& frameworkId,
286  const Option<UnavailableResources>& unavailableResources,
288  const Option<Filters>& filters = None()) = 0;
289 
290  virtual process::Future<
291  hashmap<SlaveID,
294 
295  virtual void transitionOfferedToAllocated(
296  const SlaveID& slaveId, const Resources& resources) = 0;
297 
298  virtual void recoverResources(
299  const FrameworkID& frameworkId,
300  const SlaveID& slaveId,
301  const Resources& resources,
302  const Option<Filters>& filters,
303  bool isAllocated) = 0;
304 
305  virtual void suppressOffers(
306  const FrameworkID& frameworkId,
307  const std::set<std::string>& roles) = 0;
308 
309  virtual void reviveOffers(
310  const FrameworkID& frameworkId,
311  const std::set<std::string>& roles) = 0;
312 
313  virtual void updateQuota(
314  const std::string& role,
315  const Quota& quota) = 0;
316 
317  virtual void updateWeights(
318  const std::vector<WeightInfo>& weightInfos) = 0;
319 
320  virtual void pause() = 0;
321 
322  virtual void resume() = 0;
323 };
324 
325 
326 template <typename AllocatorProcess>
329 {
330  mesos::allocator::Allocator* allocator =
332  return CHECK_NOTNULL(allocator);
333 }
334 
335 
336 template <typename AllocatorProcess>
338 {
339  process = new AllocatorProcess();
341 }
342 
343 
344 template <typename AllocatorProcess>
346 {
349  delete process;
350 }
351 
352 
353 template <typename AllocatorProcess>
355  const mesos::allocator::Options& options,
356  const lambda::function<
357  void(const FrameworkID&,
358  const hashmap<std::string, hashmap<SlaveID, Resources>>&)>&
359  offerCallback,
360  const lambda::function<
361  void(const FrameworkID&,
363  inverseOfferCallback)
364 {
366  process,
368  options,
369  offerCallback,
370  inverseOfferCallback);
371 }
372 
373 
374 template <typename AllocatorProcess>
376  const int expectedAgentCount,
377  const hashmap<std::string, Quota>& quotas)
378 {
380  process,
382  expectedAgentCount,
383  quotas);
384 }
385 
386 
387 template <typename AllocatorProcess>
389  const FrameworkID& frameworkId,
390  const FrameworkInfo& frameworkInfo,
392  bool active,
394 {
396  process,
398  frameworkId,
399  frameworkInfo,
400  used,
401  active,
402  std::move(options));
403 }
404 
405 
406 template <typename AllocatorProcess>
408  const FrameworkID& frameworkId)
409 {
411  process,
413  frameworkId);
414 }
415 
416 
417 template <typename AllocatorProcess>
419  const FrameworkID& frameworkId)
420 {
422  process,
424  frameworkId);
425 }
426 
427 
428 template <typename AllocatorProcess>
430  const FrameworkID& frameworkId)
431 {
433  process,
435  frameworkId);
436 }
437 
438 
439 template <typename AllocatorProcess>
441  const FrameworkID& frameworkId,
442  const FrameworkInfo& frameworkInfo,
444 {
446  process,
448  frameworkId,
449  frameworkInfo,
450  std::move(options));
451 }
452 
453 
454 template <typename AllocatorProcess>
456  const SlaveID& slaveId,
457  const SlaveInfo& slaveInfo,
458  const std::vector<SlaveInfo::Capability>& capabilities,
460  const Resources& total,
462 {
464  process,
466  slaveId,
467  slaveInfo,
468  capabilities,
469  unavailability,
470  total,
471  used);
472 }
473 
474 
475 template <typename AllocatorProcess>
477  const SlaveID& slaveId)
478 {
480  process,
482  slaveId);
483 }
484 
485 
486 template <typename AllocatorProcess>
488  const SlaveID& slaveId,
489  const SlaveInfo& slaveInfo,
490  const Option<Resources>& total,
491  const Option<std::vector<SlaveInfo::Capability>>& capabilities)
492 {
494  process,
496  slaveId,
497  slaveInfo,
498  total,
499  capabilities);
500 }
501 
502 template <typename AllocatorProcess>
504  const SlaveID& slave,
505  const Resources& total,
507 {
509  process,
511  slave,
512  total,
513  used);
514 }
515 
516 
517 template <typename AllocatorProcess>
519  const SlaveID& slaveId)
520 {
522  process,
524  slaveId);
525 }
526 
527 
528 template <typename AllocatorProcess>
530  const SlaveID& slaveId)
531 {
533  process,
535  slaveId);
536 }
537 
538 
539 template <typename AllocatorProcess>
541  const Option<hashset<std::string>>& whitelist)
542 {
544  process,
546  whitelist);
547 }
548 
549 
550 template <typename AllocatorProcess>
552  const FrameworkID& frameworkId,
553  const std::vector<Request>& requests)
554 {
556  process,
558  frameworkId,
559  requests);
560 }
561 
562 
563 template <typename AllocatorProcess>
565  const FrameworkID& frameworkId,
566  const SlaveID& slaveId,
567  const Resources& offeredResources,
568  const std::vector<ResourceConversion>& conversions)
569 {
571  process,
573  frameworkId,
574  slaveId,
575  offeredResources,
576  conversions);
577 }
578 
579 
580 template <typename AllocatorProcess>
583  const SlaveID& slaveId,
584  const std::vector<Offer::Operation>& operations)
585 {
586  return process::dispatch(
587  process,
589  slaveId,
590  operations);
591 }
592 
593 
594 template <typename AllocatorProcess>
596  const SlaveID& slaveId,
598 {
599  return process::dispatch(
600  process,
602  slaveId,
603  unavailability);
604 }
605 
606 
607 template <typename AllocatorProcess>
609  const SlaveID& slaveId,
610  const FrameworkID& frameworkId,
611  const Option<UnavailableResources>& unavailableResources,
613  const Option<Filters>& filters)
614 {
615  return process::dispatch(
616  process,
618  slaveId,
619  frameworkId,
620  unavailableResources,
621  status,
622  filters);
623 }
624 
625 
626 template <typename AllocatorProcess>
627 inline process::Future<
628  hashmap<SlaveID,
631 {
632  return process::dispatch(
633  process,
635 }
636 
637 template <typename AllocatorProcess>
639  const SlaveID& slaveId,
640  const Resources& resources)
641 {
643  process,
645  slaveId,
646  resources);
647 }
648 
649 
650 template <typename AllocatorProcess>
652  const FrameworkID& frameworkId,
653  const SlaveID& slaveId,
654  const Resources& resources,
655  const Option<Filters>& filters,
656  bool isAllocated)
657 {
659  process,
661  frameworkId,
662  slaveId,
663  resources,
664  filters,
665  isAllocated);
666 }
667 
668 
669 template <typename AllocatorProcess>
671  const FrameworkID& frameworkId,
672  const std::set<std::string>& roles)
673 {
675  process,
677  frameworkId,
678  roles);
679 }
680 
681 
682 template <typename AllocatorProcess>
684  const FrameworkID& frameworkId,
685  const std::set<std::string>& roles)
686 {
688  process,
690  frameworkId,
691  roles);
692 }
693 
694 
695 template <typename AllocatorProcess>
697  const std::string& role,
698  const Quota& quota)
699 {
701  process,
703  role,
704  quota);
705 }
706 
707 
708 template <typename AllocatorProcess>
710  const std::vector<WeightInfo>& weightInfos)
711 {
713  process,
715  weightInfos);
716 }
717 
718 
719 template <typename AllocatorProcess>
721 {
723 }
724 
725 
726 template <typename AllocatorProcess>
728 {
730 }
731 
732 
733 } // namespace allocator {
734 } // namespace master {
735 } // namespace internal {
736 } // namespace mesos {
737 
738 #endif // __MASTER_ALLOCATOR_MESOS_ALLOCATOR_HPP__
virtual void deactivateSlave(const SlaveID &slaveId)=0
virtual void requestResources(const FrameworkID &frameworkId, const std::vector< Request > &requests)=0
Per-framework allocator-specific options that are not part of FrameworkInfo.
Definition: allocator.hpp:147
void suppressOffers(const FrameworkID &frameworkId, const std::set< std::string > &roles) override
Suppresses offers.
Definition: allocator.hpp:670
virtual void updateInverseOffer(const SlaveID &slaveId, const FrameworkID &frameworkId, const Option< UnavailableResources > &unavailableResources, const Option< mesos::allocator::InverseOfferStatus > &status, const Option< Filters > &filters=None())=0
Definition: option.hpp:29
void activateSlave(const SlaveID &slaveId) override
Activates an agent.
Definition: allocator.hpp:518
virtual void addResourceProvider(const SlaveID &slave, const Resources &total, const hashmap< FrameworkID, Resources > &used)=0
void addFramework(const FrameworkID &frameworkId, const FrameworkInfo &frameworkInfo, const hashmap< SlaveID, Resources > &used, bool active,::mesos::allocator::FrameworkOptions &&options) override
Definition: allocator.hpp:388
void updateWeights(const std::vector< WeightInfo > &weightInfos) override
Updates the weight associated with one or more roles.
Definition: allocator.hpp:709
Definition: master.hpp:27
void requestResources(const FrameworkID &frameworkId, const std::vector< Request > &requests) override
Requests resources for a framework.
Definition: allocator.hpp:551
void recoverResources(const FrameworkID &frameworkId, const SlaveID &slaveId, const Resources &resources, const Option< Filters > &filters, bool isAllocated) override
Recovers resources.
Definition: allocator.hpp:651
virtual void recover(const int expectedAgentCount, const hashmap< std::string, Quota > &quotas)=0
Definition: check.hpp:33
void recover(const int expectedAgentCount, const hashmap< std::string, Quota > &quotas) override
Informs the allocator of the recovered state from the master.
Definition: allocator.hpp:375
virtual void deactivateFramework(const FrameworkID &frameworkId)=0
void deactivateSlave(const SlaveID &slaveId) override
Deactivates an agent.
Definition: allocator.hpp:529
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
Definition: resources.hpp:83
virtual void transitionOfferedToAllocated(const SlaveID &slaveId, const Resources &resources)=0
virtual void updateFramework(const FrameworkID &frameworkId, const FrameworkInfo &frameworkInfo,::mesos::allocator::FrameworkOptions &&options)=0
void updateQuota(const std::string &role, const Quota &quota) override
Informs the allocator to update quota for the given role.
Definition: allocator.hpp:696
void transitionOfferedToAllocated(const SlaveID &slaveId, const Resources &resources) override
This method should be invoked when the offered resources has become actually allocated.
Definition: allocator.hpp:638
virtual void addSlave(const SlaveID &slaveId, const SlaveInfo &slaveInfo, const std::vector< SlaveInfo::Capability > &capabilities, const Option< Unavailability > &unavailability, const Resources &total, const hashmap< FrameworkID, Resources > &used)=0
virtual void activateFramework(const FrameworkID &frameworkId)=0
Pass in configuration to the allocator.
Definition: allocator.hpp:53
void removeFramework(const FrameworkID &frameworkId) override
Removes a framework from the Mesos cluster.
Definition: allocator.hpp:407
static Try< mesos::allocator::Allocator * > create()
Definition: allocator.hpp:328
UPID spawn(ProcessBase *process, bool manage=false)
Spawn a new process.
void terminate(const UPID &pid, bool inject=true)
Sends a TerminateEvent to the given process.
void removeSlave(const SlaveID &slaveId) override
Removes an agent from the Mesos cluster.
Definition: allocator.hpp:476
virtual void updateQuota(const std::string &role, const Quota &quota)=0
void reviveOffers(const FrameworkID &frameworkId, const std::set< std::string > &roles) override
Revives offers to this framework for the specified roles.
Definition: allocator.hpp:683
Definition: hashmap.hpp:38
~MesosAllocatorProcess() override
Definition: allocator.hpp:191
void dispatch(const PID< T > &pid, void(T::*method)())
Definition: dispatch.hpp:174
virtual void suppressOffers(const FrameworkID &frameworkId, const std::set< std::string > &roles)=0
virtual process::Future< hashmap< SlaveID, hashmap< FrameworkID, mesos::allocator::InverseOfferStatus > > > getInverseOfferStatuses()=0
Try< Nothing > unavailability(const Unavailability &unavailability)
virtual void recoverResources(const FrameworkID &frameworkId, const SlaveID &slaveId, const Resources &resources, const Option< Filters > &filters, bool isAllocated)=0
void updateWhitelist(const Option< hashset< std::string >> &whitelist) override
Updates the list of trusted agents.
Definition: allocator.hpp:540
Try< Bytes > used(const std::string &path="/")
Definition: fs.hpp:43
Result< std::vector< Filter< Classifier > > > filters(const std::string &_link, const Handle &parent)
Definition: internal.hpp:769
void initialize(const mesos::allocator::Options &options, const lambda::function< void(const FrameworkID &, const hashmap< std::string, hashmap< SlaveID, Resources >> &)> &offerCallback, const lambda::function< void(const FrameworkID &, const hashmap< SlaveID, UnavailableResources > &)> &inverseOfferCallback) override
Initializes the allocator when the master starts up.
Definition: allocator.hpp:354
virtual void activateSlave(const SlaveID &slaveId)=0
virtual void addFramework(const FrameworkID &frameworkId, const FrameworkInfo &frameworkInfo, const hashmap< SlaveID, Resources > &used, bool active,::mesos::allocator::FrameworkOptions &&options)=0
virtual void removeSlave(const SlaveID &slaveId)=0
virtual void initialize()
Invoked when a process gets spawned.
Definition: process.hpp:100
Definition: agent.hpp:25
void updateFramework(const FrameworkID &frameworkId, const FrameworkInfo &frameworkInfo,::mesos::allocator::FrameworkOptions &&options) override
Definition: allocator.hpp:440
virtual void updateUnavailability(const SlaveID &slaveId, const Option< Unavailability > &unavailability)=0
~MesosAllocator() override
Definition: allocator.hpp:345
virtual process::Future< Nothing > updateAvailable(const SlaveID &slaveId, const std::vector< Offer::Operation > &operations)=0
void deactivateFramework(const FrameworkID &frameworkId) override
Deactivates a framework in the Mesos cluster.
Definition: allocator.hpp:429
virtual void reviveOffers(const FrameworkID &frameworkId, const std::set< std::string > &roles)=0
void updateAllocation(const FrameworkID &frameworkId, const SlaveID &slaveId, const Resources &offeredResources, const std::vector< ResourceConversion > &conversions) override
Updates allocation by applying offer operations.
Definition: allocator.hpp:564
virtual void updateWeights(const std::vector< WeightInfo > &weightInfos)=0
bool wait(const UPID &pid, const Duration &duration=Seconds(-1))
Wait for the process to exit for no more than the specified seconds.
void updateSlave(const SlaveID &slave, const SlaveInfo &slaveInfo, const Option< Resources > &total=None(), const Option< std::vector< SlaveInfo::Capability >> &capabilities=None()) override
Updates an agent.
Definition: allocator.hpp:487
void updateInverseOffer(const SlaveID &slaveId, const FrameworkID &frameworkId, const Option< UnavailableResources > &unavailableResources, const Option< mesos::allocator::InverseOfferStatus > &status, const Option< Filters > &filters) override
Definition: allocator.hpp:608
virtual void updateWhitelist(const Option< hashset< std::string >> &whitelist)=0
Basic model of an allocator: resources are allocated to a framework in the form of offers...
Definition: allocator.hpp:172
void activateFramework(const FrameworkID &frameworkId) override
Activates a framework in the Mesos cluster.
Definition: allocator.hpp:418
Definition: none.hpp:27
Definition: attributes.hpp:24
virtual void removeFramework(const FrameworkID &frameworkId)=0
process::Future< hashmap< SlaveID, hashmap< FrameworkID, mesos::allocator::InverseOfferStatus > > > getInverseOfferStatuses() override
Retrieves the status of all inverse offers maintained by the allocator.
Definition: allocator.hpp:630
void updateUnavailability(const SlaveID &slaveId, const Option< Unavailability > &unavailability) override
Updates unavailability for an agent.
Definition: allocator.hpp:595
void addSlave(const SlaveID &slaveId, const SlaveInfo &slaveInfo, const std::vector< SlaveInfo::Capability > &capabilities, const Option< Unavailability > &unavailability, const Resources &total, const hashmap< FrameworkID, Resources > &used) override
Adds or re-adds an agent to the Mesos cluster.
Definition: allocator.hpp:455
virtual void updateSlave(const SlaveID &slave, const SlaveInfo &slaveInfo, const Option< Resources > &total=None(), const Option< std::vector< SlaveInfo::Capability >> &capabilities=None())=0
Definition: executor.hpp:48
process::Future< Nothing > updateAvailable(const SlaveID &slaveId, const std::vector< Offer::Operation > &operations) override
Updates available resources on an agent based on a sequence of offer operations.
Definition: allocator.hpp:582
void resume() override
Idempotent helper to resume allocations.
Definition: allocator.hpp:727
void addResourceProvider(const SlaveID &slave, const Resources &total, const hashmap< FrameworkID, Resources > &used) override
Add resources from a local resource provider to an agent.
Definition: allocator.hpp:503
virtual void updateAllocation(const FrameworkID &frameworkId, const SlaveID &slaveId, const Resources &offeredResources, const std::vector< ResourceConversion > &conversions)=0
Definition: process.hpp:505
Definition: quota.hpp:27
void pause() override
Idempotent helper to pause allocations.
Definition: allocator.hpp:720