Complex applications require the ability to asynchronously time slice up work as to not block the main synchronous processing thread.
%%{init:{"theme":"dark"}}%%
usecase-beta
direction LR
actor tech_stack("Tech Stack")
systemBoundary "UC-01: Async"
async_sleep("Sleep")
async_task("Task")
async_timer("Timer")
async_worker("Worker")
end
tech_stack --> async_sleep
tech_stack --> async_task
tech_stack --> async_timer
tech_stack --> async_worker
%%{init:{"theme":"default"}}%%
usecase-beta
direction LR
actor tech_stack("Tech Stack")
systemBoundary "UC-01: Async"
async_sleep("Sleep")
async_task("Task")
async_timer("Timer")
async_worker("Worker")
end
tech_stack --> async_sleep
tech_stack --> async_task
tech_stack --> async_timer
tech_stack --> async_worker
usecase-beta
direction LR
actor tech_stack("Tech Stack")
systemBoundary "UC-01: Async"
async_sleep("Sleep")
async_task("Task")
async_timer("Timer")
async_worker("Worker")
end
tech_stack --> async_sleep
tech_stack --> async_task
tech_stack --> async_timer
tech_stack --> async_worker
%%{init:{"theme":"dark"}}%%
classDiagram
namespace codemelted_ns["codemelted"] {
%% Module Core
class CResult
class CProtocol
%% Async Use Case Specifics
class CFuture~T~ {
+cancel() void
+execute(T data) void
+has_completed() boolean
+result() Promise~CResult~T~~
}
class CTaskCB~T~ {
+callback(T data) T
}
class CTimerEvent {
+interval() number
}
class CTimerProtocol
class CWorkerEvent {
+as_error_event() ErrorEvent
+as_message_event() MessageEvent
+event() ErrorEvent | MessageEvent
+is_error() boolean
}
class CWorkerOptions {
+credentials string
+name string
+type string
}
class CWorkerProtocol
note for CWorkerProtocol "Not supported on Node runtime.
Make sure to use runtime_available()
to make sure it exists within the JavaScript runtime"
class codemelted {
<>
+async_sleep(delay) Promise~void~
+async_task(task, data, delay) CFuture~T~
+async_timer(name, interval, rx_handler) CTimerProtocol
+async_worker(name, options, rx_handler, url) CWorkerProtocol
}
}
CFuture --> CResult: returns
CTimerProtocol --> CTimerEvent: fires
CTimerProtocol --|> CProtocol: implements
CWorkerProtocol --> CWorkerOptions: consumes
CWorkerProtocol --> CWorkerEvent: fires
CWorkerProtocol --|> CProtocol: implements
codemelted --> CFuture: creates
codemelted --> CTaskCB: consumes
codemelted --> CTimerProtocol: creates
codemelted --> CWorkerProtocol: creates
%%{init:{"theme":"default"}}%%
classDiagram
namespace codemelted_ns["codemelted"] {
%% Module Core
class CResult
class CProtocol
%% Async Use Case Specifics
class CFuture~T~ {
+cancel() void
+execute(T data) void
+has_completed() boolean
+result() Promise~CResult~T~~
}
class CTaskCB~T~ {
+callback(T data) T
}
class CTimerEvent {
+interval() number
}
class CTimerProtocol
class CWorkerEvent {
+as_error_event() ErrorEvent
+as_message_event() MessageEvent
+event() ErrorEvent | MessageEvent
+is_error() boolean
}
class CWorkerOptions {
+credentials string
+name string
+type string
}
class CWorkerProtocol
note for CWorkerProtocol "Not supported on Node runtime.
Make sure to use runtime_available()
to make sure it exists within the JavaScript runtime"
class codemelted {
<>
+async_sleep(delay) Promise~void~
+async_task(task, data, delay) CFuture~T~
+async_timer(name, interval, rx_handler) CTimerProtocol
+async_worker(name, options, rx_handler, url) CWorkerProtocol
}
}
CFuture --> CResult: returns
CTimerProtocol --> CTimerEvent: fires
CTimerProtocol --|> CProtocol: implements
CWorkerProtocol --> CWorkerOptions: consumes
CWorkerProtocol --> CWorkerEvent: fires
CWorkerProtocol --|> CProtocol: implements
codemelted --> CFuture: creates
codemelted --> CTaskCB: consumes
codemelted --> CTimerProtocol: creates
codemelted --> CWorkerProtocol: creates
classDiagram
namespace codemelted_ns["codemelted"] {
%% Module Core
class CResult
class CProtocol
%% Async Use Case Specifics
class CFuture~T~ {
+cancel() void
+execute(T data) void
+has_completed() boolean
+result() Promise~CResult~T~~
}
class CTaskCB~T~ {
+callback(T data) T
}
class CTimerEvent {
+interval() number
}
class CTimerProtocol
class CWorkerEvent {
+as_error_event() ErrorEvent
+as_message_event() MessageEvent
+event() ErrorEvent | MessageEvent
+is_error() boolean
}
class CWorkerOptions {
+credentials string
+name string
+type string
}
class CWorkerProtocol
note for CWorkerProtocol "Not supported on Node runtime.<br>Make sure to use runtime_available()<br>to make sure it exists within the JavaScript runtime"
class codemelted {
<<module api>>
+async_sleep(delay) Promise~void~
+async_task(task, data, delay) CFuture~T~
+async_timer(name, interval, rx_handler) CTimerProtocol
+async_worker(name, options, rx_handler, url) CWorkerProtocol
}
}
CFuture --> CResult: returns
CTimerProtocol --> CTimerEvent: fires
CTimerProtocol --|> CProtocol: implements
CWorkerProtocol --> CWorkerOptions: consumes
CWorkerProtocol --> CWorkerEvent: fires
CWorkerProtocol --|> CProtocol: implements
codemelted --> CFuture: creates
codemelted --> CTaskCB: consumes
codemelted --> CTimerProtocol: creates
codemelted --> CWorkerProtocol: creates