Skip to content

Commit

Permalink
Merge branch 'alin/MR-551-CanisterQueue' into 'master'
Browse files Browse the repository at this point in the history
feat: [MR-551] Implement `CanisterQueue`

An `InputQueue` / `OutputQueue` replacement that holds references into a
`MessagePool` (for guaranteed response or best-effort messages) instead of the
messages themselves (well, `Arcs`). It can also hold a placeholder for a locally
generated (i.e. is `SYS_TRANSIENT`) drop / timeout reject response.

It maintains explicit `request_slots` and `response_slots` stats (and implicitly
tracks response slot reservations, as the difference between `response_slots`
and the actual number of enqueued responses).

`push_request()` and `push_response()` expect the caller to have checked that a
request or, respectively, response slot is available before, so they are
infallible (panicking if no slot is available). This allows the caller to first
check slot availability; on success, insert into the pool; and be guaranteed
that the resulting message reference can be enqueued. 

See merge request dfinity-lab/public/ic!18503
  • Loading branch information
alin-at-dfinity committed May 23, 2024
2 parents 943ece8 + 819a7ef commit 0ea35cd
Show file tree
Hide file tree
Showing 4 changed files with 687 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -982,13 +982,8 @@ fn assert_trimmed_priority_queues(pool: &MessagePool) {
}

/// Generates a `MessageId` for a best-effort inbound request.
pub(crate) fn new_request_message_id(generator: u64) -> MessageId {
MessageId::new(
Kind::Request,
Context::Inbound,
Class::BestEffort,
generator,
)
pub(crate) fn new_request_message_id(generator: u64, class: Class) -> MessageId {
MessageId::new(Kind::Request, Context::Inbound, class, generator)
}

/// Generates a `MessageId` for an inbound response.
Expand Down
Loading

0 comments on commit 0ea35cd

Please sign in to comment.