Skip to main content

charge_write

Function charge_write 

Source
pub(crate) fn charge_write(
    state: &AppState,
    did: &str,
    ops: usize,
    bytes: usize,
) -> Result<(), ApiError>
Expand description

Spends ops write operations and bytes request bytes of did’s share of AppState::write_meter, or refuses with 429 RateLimitExceeded.

uploadBlob runs it once the upload has been judged. Record writes hand meter_write to the store, which runs it once policy has allowed the write. Either way, a write policy refuses spends nothing of the account’s share.