diff options
Diffstat (limited to 'karlcommon')
-rw-r--r-- | karlcommon/protocol.d.ts | 6 | ||||
-rw-r--r-- | karlcommon/src/protocol.rs | 10 |
2 files changed, 5 insertions, 11 deletions
diff --git a/karlcommon/protocol.d.ts b/karlcommon/protocol.d.ts index f48b283..0d93cea 100644 --- a/karlcommon/protocol.d.ts +++ b/karlcommon/protocol.d.ts @@ -8,12 +8,10 @@ export interface Handshake { type: "handshake", data: { version: string } } export interface ListTasks { type: "list_tasks", data: null } export interface TaskList { type: "task_list", data: Task[] } export interface ListInstances { type: "list_instances", data: { task: number, range: Range } } -export interface InstanceList { type: "instance_list", data: Instance[] } +export interface InstanceList { type: "instance_list", data: Range[] } export interface UpdateTask { type: "update_task", data: Task } export interface RemoveTask { type: "remove_task", data: number } -export interface Instance { of: number, at: Range } - export interface Range { start?: number, end?: number } export interface Task { @@ -27,7 +25,7 @@ export interface Task { export type Schedule = { type: "never" } | { type: "static", options: Range } | { type: "condition", options: Condition } - | { type: "dynamic", options: { priority: number, scheduled?: number, deadline?: Condition } } + | { type: "dynamic", options: { priority: number, scheduled?: number, deadline?: number } } export type Condition = { from?: Condition } | { or?: Condition[] } diff --git a/karlcommon/src/protocol.rs b/karlcommon/src/protocol.rs index de65802..25dfc66 100644 --- a/karlcommon/src/protocol.rs +++ b/karlcommon/src/protocol.rs @@ -8,7 +8,7 @@ pub enum ClientboundPacket { Handshake { version: String }, Error(ProtoError), TaskList(Vec<Task>), - InstanceList(Vec<Instance>), + InstanceList(Vec<Range<Option<i64>>>), Sync, } @@ -52,17 +52,13 @@ pub enum Schedule { Dynamic { priority: f64, scheduled: Option<i64>, - deadline: Option<Condition>, + duration: i64, + condition: Condition, // duration, during which the task should be scheduled }, Condition(Condition), Static(Range<i64>), } -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Instance { - pub of: u64, - pub at: Range<Option<i64>>, -} #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] |