Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/compute-at-edge-abi/compute-at-edge.witx
Original file line number Diff line number Diff line change
Expand Up @@ -486,3 +486,12 @@
(result $err (expected (error $fastly_status)))
)
)

(module $fastly_purge
(@interface func (export "purge_surrogate_key")
(param $surrogate_key string)
(param $options_mask $purge_options_mask)
(param $options (@witx pointer $purge_options))
(result $err (expected (error $fastly_status)))
)
)
16 changes: 16 additions & 0 deletions lib/compute-at-edge-abi/typenames.witx
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,19 @@
(field $sni_hostname (@witx pointer (@witx char8)))
(field $sni_hostname_len u32)
))

(typename $purge_options_mask
(flags (@witx repr u32)
$soft_purge
$ret_buf ;; all ret_buf fields must be populated
)
)

(typename $purge_options
(record
;; JSON purge response as in https://developer.fastly.com/reference/api/purging/#purge-tag
(field $ret_buf_ptr (@witx pointer u8))
(field $ret_buf_len (@witx usize))
(field $ret_buf_nwritten_out (@witx pointer (@witx usize)))
)
)
1 change: 1 addition & 0 deletions lib/src/linking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub fn link_host_functions(linker: &mut Linker<WasmCtx>) -> Result<(), Error> {
wiggle_abi::fastly_http_resp::add_to_linker(linker, WasmCtx::session)?;
wiggle_abi::fastly_log::add_to_linker(linker, WasmCtx::session)?;
wiggle_abi::fastly_object_store::add_to_linker(linker, WasmCtx::session)?;
wiggle_abi::fastly_purge::add_to_linker(linker, WasmCtx::session)?;
wiggle_abi::fastly_uap::add_to_linker(linker, WasmCtx::session)?;
link_legacy_aliases(linker)?;
Ok(())
Expand Down
1 change: 1 addition & 0 deletions lib/src/wiggle_abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ macro_rules! multi_value_result {
mod body_impl;
mod dictionary_impl;
mod entity;
mod fastly_purge_impl;
mod geo_impl;
mod headers;
mod log_impl;
Expand Down
19 changes: 19 additions & 0 deletions lib/src/wiggle_abi/fastly_purge_impl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//! fastly_purge` hostcall implementations.

use {
super::types::{PurgeOptions, PurgeOptionsMask},
crate::{error::Error, session::Session, wiggle_abi::fastly_purge::FastlyPurge},
wiggle::GuestPtr,
};

impl FastlyPurge for Session {
#[allow(unused_variables)] // FIXME FDE 2022-09-26: Remove this directive once implemented.
fn purge_surrogate_key<'a>(
&mut self,
surrogate_key: &GuestPtr<'a, str>,
options_mask: PurgeOptionsMask,
options: &GuestPtr<'a, PurgeOptions<'a>>,
) -> Result<(), Error> {
Err(Error::NotAvailable("FastlyPurge"))
}
}