public IActionResult List(
     [FromRoute] Behaviors behavior,
     [FromQuery] SortBy sortBy = SortBy.Default)
 {
     return(Ok(_store.GetFor(behavior.ToString())
               .List(sortBy)));
 }
        public IActionResult KillAllProcesses(
            [FromRoute] Behaviors behavior)
        {
            _store.GetFor(behavior.ToString())
            .KillAll();

            return(Ok());
        }
        public IActionResult Initialize(
            [FromRoute] Behaviors behavior,
            [FromQuery] int maxCapacity)
        {
            _store.CreateOrReplace(behavior.ToString(), maxCapacity);

            return(Ok());
        }
Пример #4
0
    void SwitchBehavior()
    {
        Array values = Behaviors.GetValues(typeof(Behaviors));

        state         = (Behaviors)Rand.ChooseOne(values);
        behaviorTimer = Rand.Range(behaviorTimerMin, behaviorTimerMax);
        print("My state is: " + state.ToString() + ", Next behavior in " + behaviorTimer + " seconds");
    }
        public IActionResult KillProcessByGroup(
            [FromRoute] Behaviors behavior,
            [FromRoute] int priority)
        {
            _store.GetFor(behavior.ToString())
            .KillGroup(priority);

            return(Ok());
        }
        public IActionResult KillProcess(
            [FromRoute] Behaviors behavior,
            [FromRoute] int pid)
        {
            _store.GetFor(behavior.ToString())
            .Kill(pid);

            return(Ok());
        }
        public IActionResult AddProcess(
            [FromRoute] Behaviors behavior,
            [FromBody] AddProcessRequest request)
        {
            _store.GetFor(behavior.ToString())
            .Add(new Process(request.PID, request.Priority));

            return(Ok());
        }