Skip to content

Commit

Permalink
Add accept-offers method (#16)
Browse files Browse the repository at this point in the history
* Mirror the behaviour of the Java library.

This may be a risky change, as other code/projects could theoretically depend
upon the old behaviour (I'm pretty sure it was broken, regardless).

This addresses issue #8, but may need more work (depending upon impact).

* Updated method names to match current Proto.java.

* Fixed typo (:driver -> driver) in reregistered.

* Added import for operation and its constants.

* Added pb->data for Operation types.

* Added Operatoin record and pb->data method.

* Added pb->data for operation types.

* Finished first draft of #11.

* Added missing imports.

* Added accept-offers method.
  • Loading branch information
oubiwann authored and pyr committed Aug 31, 2016
1 parent bca1dc0 commit 8116b0a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/mesomatic/scheduler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

(defprotocol SchedulerDriver
(abort! [this])
(accept-offers [this offer-ids operations]
[this offer-ids operations filters])
(decline-offer [this offer-id] [this offer-id filters])
(join! [this])
(kill-task! [this task-id])
Expand All @@ -32,6 +34,16 @@
(reify SchedulerDriver
(abort! [this]
(pb->data (.abort d)))
(accept-offers [this offer-ids operations]
(pb->data (.acceptOffers d
(mapv (partial ->pb :OfferID) offer-ids)
(mapv (partial ->pb :Operation) operations)
(->pb :Filters {:refuse-seconds 1}))))
(accept-offers [this offer-ids operations filters]
(pb->data (.acceptOffers d
(mapv (partial ->pb :OfferID) offer-ids)
(mapv (partial ->pb :Operation) operations)
(mapv (partial ->pb :Filters) filters))))
(decline-offer [this offer-id]
(pb->data (.declineOffer d (->pb :OfferID offer-id))))
(decline-offer [this offer-id filters]
Expand Down

0 comments on commit 8116b0a

Please sign in to comment.