// getOffer returns cached offer func (cache *schedCache) getOffer(offerId *mesos.OfferID) *cachedOffer { if offerId == nil { log.V(3).Infoln("WARN: OfferId == nil, returning nil") return nil } cache.lock.RLock() defer cache.lock.RUnlock() return cache.savedOffers[offerId.GetValue()] }
func (cache *schedCache) removeOffer(offerId *mesos.OfferID) { cache.lock.Lock() delete(cache.savedOffers, offerId.GetValue()) cache.lock.Unlock() }
// containsOff test cache for offer(offerId) func (cache *schedCache) containsOffer(offerId *mesos.OfferID) bool { cache.lock.RLock() defer cache.lock.RUnlock() _, ok := cache.savedOffers[offerId.GetValue()] return ok }