README

wcx789ll/moonsim/resource does not have a README file

#
ActiveHolder

pub(all) struct ActiveHolder {
id : Int
amount : Int
priority : Int
preempt_callback : () -> Unit
}

#
Container

pub(all) struct Container {
name : String
capacity : Double
level : Double
// private fields
}

#
Container::capacity

fn Container::capacity(self : Container) -> Double

#
Container::get

fn Container::get(self : Container, amount : Double, callback : (Bool) -> Unit) -> Unit

#
Container::level

fn Container::level(self : Container) -> Double

#
Container::new

fn Container::new(name : String, capacity : Double, initial_level : Double) -> Container

#
Container::put

fn Container::put(self : Container, amount : Double, callback : (Bool) -> Unit) -> Unit

#
PreemptibleResource

pub(all) struct PreemptibleResource {
name : String
capacity : Int
available : Int
next_req_id : Int
next_holder_id : Int
// private fields
}

#
PreemptibleResource::available

fn PreemptibleResource::available(self : PreemptibleResource) -> Int

#
PreemptibleResource::capacity

fn PreemptibleResource::capacity(self : PreemptibleResource) -> Int

#
PreemptibleResource::holder_count

fn PreemptibleResource::holder_count(self : PreemptibleResource) -> Int

#
PreemptibleResource::is_holder_active

fn PreemptibleResource::is_holder_active(self : PreemptibleResource, holder_id : Int) -> Bool

Return whether a holder token is still active.

A preempted holder becomes inactive immediately. Delayed completion callbacks should check this before releasing capacity or recording a successful completion, because the callback may run after preemption.

#
PreemptibleResource::new

fn PreemptibleResource::new(name : String, capacity : Int) -> PreemptibleResource

#
PreemptibleResource::release

fn PreemptibleResource::release(self : PreemptibleResource, holder_id : Int) -> Unit

#
PreemptibleResource::request

fn PreemptibleResource::request(self : PreemptibleResource, amount : Int, priority : Int, callback : (Int?) -> Unit, preempt_callback : () -> Unit) -> Int

#
Resource

pub(all) struct Resource {
name : String
capacity : Int
available : Int
next_req_id : Int
// private fields
}

#
Resource::available

fn Resource::available(self : Resource) -> Int

#
Resource::cancel_request

fn Resource::cancel_request(self : Resource, req_id : Int) -> Bool

#
Resource::capacity

fn Resource::capacity(self : Resource) -> Int

#
Resource::new

fn Resource::new(name : String, capacity : Int) -> Resource

#
Resource::queue_length

fn Resource::queue_length(self : Resource) -> Int

#
Resource::release

fn Resource::release(self : Resource, amount : Int) -> Unit

#
Resource::request

fn Resource::request(self : Resource, amount : Int, priority : Int, callback : (Bool) -> Unit) -> Int

#
ResourceRequest

pub(all) struct ResourceRequest {
id : Int
amount : Int
priority : Int
callback : (Bool) -> Unit
cancelled : Bool
}

#
Store

pub(all) struct Store[T] {
name : String
capacity : Int
// private fields
}

#
Store::capacity

fn[T] Store::capacity(self : Store[T]) -> Int

#
Store::get

fn[T] Store::get(self : Store[T], callback : (T) -> Unit) -> Unit

#
Store::new

fn[T] Store::new(name : String, capacity : Int) -> Store[T]

#
Store::put

fn[T] Store::put(self : Store[T], item : T, callback : () -> Unit) -> Unit

#
Store::size

fn[T] Store::size(self : Store[T]) -> Int

#
StoreGetRequest

pub(all) struct StoreGetRequest[T] {
callback : (T) -> Unit
}

#
StorePutRequest

pub(all) struct StorePutRequest[T] {
item : T
callback : () -> Unit
}

#
request_with_timeout

fn request_with_timeout(mgr :
EventManager
, res : Resource, amount : Int, priority : Int, timeout : Double, callback : (Bool) -> Unit) ->
EventId

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io