2021-07-03 07:03:52 +00:00
|
|
|
pub use preserves::value;
|
|
|
|
|
|
|
|
use std::sync::atomic::AtomicU64;
|
|
|
|
use std::sync::atomic::Ordering;
|
2021-07-08 22:04:11 +00:00
|
|
|
use actor::Handle;
|
|
|
|
use actor::Oid;
|
2021-07-03 07:03:52 +00:00
|
|
|
|
|
|
|
pub mod actor;
|
2020-05-11 18:51:04 +00:00
|
|
|
pub mod bag;
|
2020-05-18 11:16:14 +00:00
|
|
|
pub mod config;
|
2020-05-11 18:51:04 +00:00
|
|
|
pub mod dataspace;
|
2021-07-08 22:04:11 +00:00
|
|
|
pub mod during;
|
2021-07-03 07:03:52 +00:00
|
|
|
pub mod error;
|
|
|
|
pub mod pattern;
|
2021-07-06 18:56:36 +00:00
|
|
|
pub mod relay;
|
|
|
|
pub mod schemas;
|
2020-05-11 18:51:04 +00:00
|
|
|
pub mod skeleton;
|
2021-07-08 22:04:11 +00:00
|
|
|
pub mod tracer;
|
2020-05-11 18:51:04 +00:00
|
|
|
|
2021-07-08 22:04:11 +00:00
|
|
|
pub use tracer::tracer;
|
|
|
|
pub use tracer::tracer_top;
|
2021-07-03 07:03:52 +00:00
|
|
|
|
|
|
|
pub type ActorId = u64;
|
2021-07-08 22:04:11 +00:00
|
|
|
|
|
|
|
const BUMP_AMOUNT: u8 = 10;
|
|
|
|
|
|
|
|
static NEXT_ACTOR_ID: AtomicU64 = AtomicU64::new(1);
|
2021-07-03 07:03:52 +00:00
|
|
|
pub fn next_actor_id() -> ActorId {
|
2021-07-08 22:04:11 +00:00
|
|
|
NEXT_ACTOR_ID.fetch_add(BUMP_AMOUNT.into(), Ordering::Relaxed)
|
2021-07-03 07:03:52 +00:00
|
|
|
}
|
|
|
|
|
2021-07-08 22:04:11 +00:00
|
|
|
static NEXT_OID: AtomicU64 = AtomicU64::new(2);
|
2021-07-03 07:03:52 +00:00
|
|
|
pub fn next_oid() -> Oid {
|
|
|
|
Oid(value::signed_integer::SignedInteger::from(
|
2021-07-08 22:04:11 +00:00
|
|
|
NEXT_OID.fetch_add(BUMP_AMOUNT.into(), Ordering::Relaxed) as u128))
|
2021-07-03 07:03:52 +00:00
|
|
|
}
|
|
|
|
|
2021-07-08 22:04:11 +00:00
|
|
|
static NEXT_HANDLE: AtomicU64 = AtomicU64::new(3);
|
2021-07-03 07:03:52 +00:00
|
|
|
pub fn next_handle() -> Handle {
|
|
|
|
Handle(value::signed_integer::SignedInteger::from(
|
2021-07-08 22:04:11 +00:00
|
|
|
NEXT_HANDLE.fetch_add(BUMP_AMOUNT.into(), Ordering::Relaxed) as u128))
|
2021-07-03 07:03:52 +00:00
|
|
|
}
|
2020-05-11 18:51:04 +00:00
|
|
|
|
2021-07-08 22:04:11 +00:00
|
|
|
static NEXT_MAILBOX_ID: AtomicU64 = AtomicU64::new(4);
|
2021-07-03 07:03:52 +00:00
|
|
|
pub fn next_mailbox_id() -> u64 {
|
2021-07-08 22:04:11 +00:00
|
|
|
NEXT_MAILBOX_ID.fetch_add(BUMP_AMOUNT.into(), Ordering::Relaxed)
|
2021-07-03 07:03:52 +00:00
|
|
|
}
|