use crate::{Fracpack, ToSchema};
use async_graphql::SimpleObject;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, Fracpack, ToSchema, SimpleObject)]
#[fracpack(fracpack_mod = "fracpack")]
pub struct ServerSpecs {
pub net_bps: u64,
pub storage_bytes: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize, Fracpack, ToSchema, SimpleObject)]
#[fracpack(fracpack_mod = "fracpack")]
pub struct NetworkVariables {
pub block_replay_factor: u8,
pub per_block_sys_cpu_ns: u64,
pub obj_storage_bytes: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize, Fracpack, ToSchema, SimpleObject)]
#[fracpack(fracpack_mod = "fracpack")]
pub struct BufferConfig {
pub threshold_percent: u8,
pub capacity: u64,
}
#[crate::service(name = "virtual-server", dispatch = false, psibase_mod = "crate")]
#[allow(non_snake_case, unused_variables)]
mod service {
use super::{BufferConfig, NetworkVariables, ServerSpecs};
use crate::services::tokens::Quantity;
use crate::*;
#[action]
fn init() {
unimplemented!()
}
#[pre_action(exclude(init))]
fn check_init() {
unimplemented!()
}
#[action]
fn init_billing(fee_receiver: AccountNumber) {
unimplemented!()
}
#[action]
fn get_fee_receiver() -> Option<AccountNumber> {
unimplemented!()
}
#[action]
fn set_specs(specs: ServerSpecs) {
unimplemented!()
}
#[action]
fn set_network_variables(variables: NetworkVariables) {
unimplemented!()
}
#[action]
fn enable_billing(enabled: bool) {
unimplemented!()
}
#[action]
fn is_billing_enabled() -> bool {
unimplemented!()
}
#[action]
fn buy_res_for(amount: Quantity, for_user: AccountNumber, memo: Option<crate::Memo>) {
unimplemented!()
}
#[action]
fn buy_res_sub(amount: Quantity, sub_account: String) {
unimplemented!()
}
#[action]
fn del_res_sub(sub_account: String) {
unimplemented!()
}
#[action]
fn res_balance() -> Quantity {
unimplemented!()
}
#[action]
fn res_balance_sub(sub_account: String) -> Quantity {
unimplemented!()
}
#[action]
fn buy_res(amount: Quantity) {
unimplemented!()
}
#[action]
fn bill_to_sub(sub_account: String) {
unimplemented!()
}
#[action]
fn conf_buffer(config: Option<BufferConfig>) {
unimplemented!()
}
#[action]
fn std_buffer_cost() -> Quantity {
unimplemented!()
}
#[action]
fn net_thresholds(idle_ppm: u32, congested_ppm: u32) {
unimplemented!()
}
#[action]
fn net_rates(doubling_time_sec: u32, halving_time_sec: u32) {
unimplemented!()
}
#[action]
fn net_blocks_avg(num_blocks: u8) {
unimplemented!()
}
#[action]
fn net_min_unit(bits: u64) {
unimplemented!()
}
#[action]
fn get_net_cost(bytes: u64) -> Quantity {
unimplemented!()
}
#[action]
fn cpu_thresholds(idle_ppm: u32, congested_ppm: u32) {
unimplemented!()
}
#[action]
fn cpu_rates(doubling_time_sec: u32, halving_time_sec: u32) {
unimplemented!()
}
#[action]
fn cpu_blocks_avg(num_blocks: u8) {
unimplemented!()
}
#[action]
fn cpu_min_unit(ns: u64) {
unimplemented!()
}
#[action]
fn get_cpu_cost(ns: u64) -> Quantity {
unimplemented!()
}
#[action]
fn useNetSys(user: AccountNumber, amount_bytes: u64) {
unimplemented!()
}
#[action]
fn useCpuSys(user: AccountNumber, amount_ns: u64) {
unimplemented!()
}
#[action]
fn get_resources(user: AccountNumber) -> Quantity {
unimplemented!()
}
#[action]
fn notifyBlock(block_num: BlockNum) {
unimplemented!()
}
#[action]
fn setBillableAcc(account: AccountNumber) {
unimplemented!()
}
#[action]
fn serveSys(
request: HttpRequest,
_socket: Option<i32>,
user: Option<AccountNumber>,
) -> Option<HttpReply> {
unimplemented!()
}
#[event(history)]
fn consumed(account: AccountNumber, resource: u8, amount: u64, cost: u64) {}
#[event(history)]
fn subsidized(
purchaser: AccountNumber,
recipient: AccountNumber,
amount: u64,
memo: crate::Memo,
) {
}
#[event(history)]
fn block_summary(block_num: BlockNum, net_usage_ppm: u32, cpu_usage_ppm: u32) {}
}
#[test]
fn verify_schema() {
crate::assert_schema_matches_package::<Wrapper>();
}