package com.lanyuanxiaoyao.service.scheduler.quartz.distribute.strategy;

import java.util.function.Predicate;
import org.eclipse.collections.api.map.ImmutableMap;

/**
 * 通过Metadata信息限制调度
 *
 * @author lanyuanxiaoyao
 */
public class MetadataLimit implements AvailableStrategy {
    private final Predicate<ImmutableMap<String, String>> predicate;

    public MetadataLimit(Predicate<ImmutableMap<String, String>> predicate) {
        this.predicate = predicate;
    }

    @Override
    public boolean available(ImmutableMap<String, String> metadata) {
        return predicate.test(metadata);
    }
}
