Skip to content

Passing refs or shared_ptrs from filter factories? #8633

@rgs1

Description

@rgs1

I had assumed that a filter should not expect to outlive the factory lambda that created it, so it should receive its config objects via a shared_ptr, e.g.:

https://github.com/envoyproxy/envoy/blob/master/source/extensions/filters/http/header_to_metadata/config.cc#L24

And that's pretty much true for all filters, except for this one:

https://github.com/envoyproxy/envoy/blob/master/source/extensions/filters/http/original_src/original_src_config_factory.cc#L19

Is it OK then for filters to assume their creator will outlive them (and thus can we ditch shared_ptrs and pass refs instead)? Would be nice to have some consistency there (PRs to follow, if we agree).

cc: @mattklein123 @jparise @derekargueta

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

    Issue actions