Task: develop a task manager.
This was done using the Clojure programming language.
- Ensure you have the latest version of the Java Development Kit installed.
- Install Leiningen.
Currently, this task only contains unit tests, which can be run as follows:
lein test
The core of the project is the task-manager
package, which defines
a couple of functions as a contract for the requirements of the challenge.
Namely:
task-manager.utils
includes constants and utility functions for this project.- In particular, the total number of tasks
total-tasks
is defined as a constant here.
- In particular, the total number of tasks
- The
task-manager.model
namespace defines the data structures for manipulation:task
s are defined as a hash map with the following fields:pid
: an UUID to identify the current taskpriority
: can be picked as either:low
,:medium
, or:high
. Internally, it will be assigned to a number using theutils/get-priority
function. The smaller this number, the higher the priority.creation-time
: timestamp of task creationcommand
: a string with the desired command to run
- the
task-manager
itself, which is currently being treated as a list
- The
task-manager.add-task
namespace defines functions to add tasks to the task manager using the following algorithms:default-add
only adds a task if there is room in the task managerfifo-add
clears space for new tasks by deleting the oldest onespriority-add
only adds tasks give they have enough priority when compared to the existing ones.
- The
task-manager.list-task
namespace lists tasks using the required strategies:by-creation-time
,by-priority
, andby-pid
. - The
task-manager.kill-task
namespace includes functions to remove tasks from the task manager, namelyby-pid
,by-priority
, or killall
tasks.- As a known behavior, since tasks do not execute their commands, this only
means removing
task
s from thetask-manager
list.
- As a known behavior, since tasks do not execute their commands, this only
means removing
- Java interoperation is not yet properly implemented.
- The task manager doesn't start real system tasks.
- Compiling the application with
lein uberjar
will generate a simpleHello World!
.
Copyright © 2021 Cristiano Silva Jr.
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.