-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add downstream_compliance_region
hostcall
#403
Conversation
df89966
to
5732ccb
Compare
5732ccb
to
9ab65ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, though the max_len
param should be kept if downstream_compliance_region
can return an arbitrary-length vector.
lib/wit/deps/fastly/compute.wit
Outdated
downstream-compliance-region: func(max-len: u64) -> result<list<u8>, error>; | ||
downstream-compliance-region: func() -> result<list<u8>, error>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add max-len
back in? It's to help with the adapter, as it's ensuring that the returned vector that will be placed in the guest-provided buffer will be large enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 656a5a9.
lib/src/component/http_req.rs
Outdated
async fn downstream_compliance_region(&mut self) -> Result<Vec<u8>, types::Error> { | ||
Ok(Vec::from(b"none")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add a check here that max_len >= 4
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 656a5a9.
Can we find a place to keep track of hardcoded values like this, so that as part of the discussion about making development and testing easier (the 'redesign fastly.toml' topic) we can provide ways to make these configurable in the future? "none" is certainly a valid and expected value, but customers should be able to test their code against the other values they could see in production. cc @kailan |
For now I've made this part of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
This PR implements the
downstream_compliance_region
hostcall, which will eventually be exposed in the SDK when the Compliance Regions GA happens. I've made it so that it currently always returns"none"
, which is what you will see in Compute when you aren't using Compliance Regions with your service.I've also updated the signature of the component interface to be more similar to
downstream-tls-ja3-md5
, since it just returns aVec<u8>
and doesn't need to know themax-len
. (Let me know if I'm misunderstanding how the component interfaces should work.)