cloudflare / wirefilter

An execution engine for Wireshark-like filters
https://blog.cloudflare.com/building-fast-interpreters-in-rust/
MIT License
958 stars 85 forks source link

Remove requirement for ExecutionContext to have the same lifetime as a filter #57

Closed inikulin closed 4 years ago

RReverser commented 4 years ago

I'm pretty sure that it was an intentional restriction to limit accepted lifetimes... but I guess you have reasons to make the change :)

inikulin commented 4 years ago

@RReverser Yep. I have filters living in the LRU-cache built with 'static scheme and execution context is obviously lives much less.

RReverser commented 4 years ago

The 's parameter in ExecutionContext is not lifetime of execution context itself, but of the scheme, and scheme should probably live as long as your filters, because they borrow from it.

inikulin commented 4 years ago

@RReverser nope: https://github.com/cloudflare/wirefilter/blob/master/engine/src/execution_context.rs#L11-L13 'e is a common minimal lifetime of Scheme and borrowed field values, i.e. 's: 'e. But, filter requires execution context to leave as long as Scheme reference in it (which in my case is 'static). In other words, currently you can't execute Filter<'static> using execution context with arbitrary lifetime.

jaysonsantos commented 4 years ago

Hey there, are there any plans to release a new version soon? I had the same problem and it is currently solved in master. Thank you!

inikulin commented 4 years ago

@RReverser I'm not sure I have cargo publishing rights. May I ask you to do that?

xtuc commented 4 years ago

I suppose our team we should have publish perms