Skip to content

How to remove shared data key using rust? #301

@leandrocurioso

Description

@leandrocurioso

I am building a rust filter and using the shared data, I noticed that we have implementations of:

https://github.com/proxy-wasm/proxy-wasm-rust-sdk/blob/main/src/traits.rs#L32

get_shared_data and set_shared_data

I need a way to delete the key. I couldn't find a function do do that.

Can someone please share an example?

Thanks in advance!

Activity

PiotrSikora

PiotrSikora commented on Mar 15, 2025

@PiotrSikora
Member

set_shared_data(key, None, None) can be used to delete the key, but knowing this is a low-level ABI detail and it shouldn't be leaked to the SDK, so I've added remove_shared_data() (#307).

Note that some hosts will remove the key (e.g. NGINX), while others will only remove the key's value (e.g. Envoy).

leandrocurioso

leandrocurioso commented on Apr 29, 2025

@leandrocurioso
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @PiotrSikora@leandrocurioso

        Issue actions

          How to remove shared data key using rust? · Issue #301 · proxy-wasm/proxy-wasm-rust-sdk