envoyproxy / java-control-plane

Java implementation of an Envoy gRPC control plane
Apache License 2.0
293 stars 136 forks source link

server: add a snapshot collecting DiscoveryServerCallbacks #73

Closed snowp closed 6 years ago

snowp commented 6 years ago

Adds a callback that watches the streams for requests and stream closes and cleans up unreferenced snapshots after some time period.

This upstreams the GC mechanism we've been using internally for a few months.

Signed-off-by: Snow Pettersen snowp@squareup.com

codecov-io commented 6 years ago

Codecov Report

Merging #73 into master will increase coverage by 0.09%. The diff coverage is 95.55%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #73      +/-   ##
============================================
+ Coverage     94.52%   94.62%   +0.09%     
- Complexity      115      130      +15     
============================================
  Files            12       13       +1     
  Lines           457      502      +45     
  Branches         39       44       +5     
============================================
+ Hits            432      475      +43     
  Misses           18       18              
- Partials          7        9       +2
Impacted Files Coverage Δ Complexity Δ
...ava/io/envoyproxy/controlplane/cache/Snapshot.java 100% <100%> (ø) 23 <1> (+1) :arrow_up:
...ne/server/callback/SnapshotCollectingCallback.java 95.34% <95.34%> (ø) 14 <14> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ed1c340...16db7bf. Read the comment docs.

snowp commented 6 years ago

Open to integrating this more with the DiscoveryServer, for now this just adds the callback itself. I can imagine something like DiscoveryServer.createWithCollector(cache, collectAfterMinutes)

snowp commented 6 years ago

ping @joeyb