Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(213)

Issue 23041: Limited invalidation support

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 6 months ago by louiscryan
Modified:
16 years, 6 months ago
Reviewers:
beaton, awiner1, panjie.pan, panjie, shindig-dev
Base URL:
http://svn.apache.org/repos/asf/incubator/shindig/trunk/
Visibility:
Public.

Description

This is an initial implementation of the "Limited Invalidation" spec. Containers are expected to implement their own InvalidationService based on their caching behavior This implementation differs from the spec in a couple of ways that I believe are worth proposing as clarifications. - The service endpoint is "cache/invalidate" not "invalidate" for REST. For RPC the method is "cache.invalidate" - Only 2-legged consumer OAuth calls can invalidate URLs - Security token for rendering gadgets can only be used to invalidate the viewers data - Viewer data is invalidated by default and a simple GET /social/rest/cache/invalidate will trigger it The default request pipeline is altered to allow invalidated content to be returned if fetching a replacement causes an error as is suggested in the spec.

Patch Set 1 #

Total comments: 45

Patch Set 2 : Updated #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+930 lines, -76 lines) Patch
java/common/src/main/java/org/apache/shindig/auth/AnonymousAuthenticationHandler.java View 2 chunks +1 line, -2 lines 0 comments Download
java/common/src/main/java/org/apache/shindig/auth/AnonymousSecurityToken.java View 1 chunk +4 lines, -0 lines 0 comments Download
java/common/src/main/java/org/apache/shindig/auth/AuthenticationHandler.java View 2 chunks +5 lines, -3 lines 0 comments Download
java/common/src/main/java/org/apache/shindig/auth/AuthenticationMode.java View 1 1 chunk +52 lines, -0 lines 0 comments Download
java/common/src/main/java/org/apache/shindig/auth/BasicSecurityToken.java View 2 chunks +6 lines, -2 lines 0 comments Download
java/common/src/main/java/org/apache/shindig/auth/BlobCrypterSecurityToken.java View 2 chunks +6 lines, -2 lines 0 comments Download
java/common/src/main/java/org/apache/shindig/auth/SecurityToken.java View 1 1 chunk +6 lines, -0 lines 0 comments Download
java/common/src/main/java/org/apache/shindig/auth/UrlParameterAuthenticationHandler.java View 2 chunks +4 lines, -6 lines 0 comments Download
java/common/src/test/java/org/apache/shindig/common/testing/FakeGadgetToken.java View 4 chunks +10 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/DefaultInvalidationService.java View 1 1 chunk +157 lines, -0 lines 6 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/DefaultRequestPipeline.java View 1 1 chunk +31 lines, -14 lines 2 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/InvalidationHandler.java View 1 1 chunk +104 lines, -0 lines 2 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/InvalidationService.java View 1 1 chunk +70 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/NoOpInvalidationService.java View 1 chunk +45 lines, -0 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyHandler.java View 3 chunks +6 lines, -6 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/http/DefaultInvalidationServiceTest.java View 1 1 chunk +224 lines, -0 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/http/DefaultRequestPipelineTest.java View 5 chunks +4 lines, -5 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/http/InvalidationHandlerTest.java View 1 chunk +139 lines, -0 lines 0 comments Download
java/server/src/test/java/org/apache/shindig/server/JettyLauncher.java View 2 chunks +9 lines, -5 lines 0 comments Download
java/server/src/test/java/org/apache/shindig/server/endtoend/EndToEndModule.java View 2 chunks +4 lines, -1 line 0 comments Download
java/social-api/src/main/java/org/apache/shindig/social/core/config/SocialApiGuiceModule.java View 2 chunks +2 lines, -1 line 0 comments Download
java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java View 3 chunks +8 lines, -8 lines 0 comments Download
java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthConsumerRequestAuthenticationHandler.java View 3 chunks +9 lines, -11 lines 0 comments Download
java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthSecurityToken.java View 3 chunks +12 lines, -0 lines 0 comments Download
java/social-api/src/main/java/org/apache/shindig/social/sample/oauth/SampleOAuthDataStore.java View 2 chunks +10 lines, -9 lines 0 comments Download
java/social-api/src/test/java/org/apache/shindig/social/SocialApiTestsGuiceModule.java View 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 6
louiscryan
16 years, 6 months ago (2009-02-27 18:50:52 UTC) #1
awiner
Didn't look much at the tests. http://codereview.appspot.com/23041/diff/1/11 File java/common/src/main/java/org/apache/shindig/auth/AuthenticationMode.java (right): http://codereview.appspot.com/23041/diff/1/11#newcode24 Line 24: some docs ...
16 years, 6 months ago (2009-02-27 22:40:51 UTC) #2
louiscryan
http://codereview.appspot.com/23041/diff/1/11 File java/common/src/main/java/org/apache/shindig/auth/AuthenticationMode.java (right): http://codereview.appspot.com/23041/diff/1/11#newcode24 Line 24: On 2009/02/27 22:40:51, awiner wrote: > some docs ...
16 years, 6 months ago (2009-02-28 00:15:57 UTC) #3
louiscryan
Updated
16 years, 6 months ago (2009-03-02 21:11:51 UTC) #4
panjie.pan
http://codereview.appspot.com/23041/diff/3023/2032 File java/gadgets/src/main/java/org/apache/shindig/gadgets/http/DefaultInvalidationService.java (right): http://codereview.appspot.com/23041/diff/3023/2032#newcode71 Line 71: public void invalidateApplicationResources(Set<Uri> uris, SecurityToken token) { (Collection<Url> ...
16 years, 6 months ago (2009-03-04 05:54:26 UTC) #5
louiscryan
16 years, 6 months ago (2009-03-04 06:58:42 UTC) #6
Thanks for taking a look Pan. I will post a proposed revision to the spec based
on this work soon.

http://codereview.appspot.com/23041/diff/3023/2032
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/DefaultInvalidationService.java
(right):

http://codereview.appspot.com/23041/diff/3023/2032#newcode71
Line 71: public void invalidateApplicationResources(Set<Uri> uris, SecurityToken
token) {
On 2009/03/04 05:54:27, panjie.pan wrote:
> (Collection<Url> uris, SecurityToken token) should be enough.

Logically its a set, no need to be less specific.

http://codereview.appspot.com/23041/diff/3023/2032#newcode74
Line 74: httpCache.removeResponse(new HttpRequest(uri));
On 2009/03/04 05:54:27, panjie.pan wrote:
> I think we should mark response as invalid response rather than remove it. So
> that we can serve stale response when backend is unavailable.

Given that this is for specs and message bundles which have their own post-parse
caches this should be fine. If an app decides to flush itself it had better make
sure the replacement is available.

http://codereview.appspot.com/23041/diff/3023/2032#newcode83
Line 83: */
On 2009/03/04 05:54:27, panjie.pan wrote:
> To invalidate a user will invalidate all request/response whose owner/viewer
is
> the user. Shall we separate owner from viewer?

Thats actually what happens, take a look at how we add the marks to the
HttpResponses prior to caching them. A response fetched signed by viewer only
requires the mark for the viewer to match, a response fetched signed by owner
only requires to owner mark to match, a response fetched signed by both requires
both marks to match.

http://codereview.appspot.com/23041/diff/3023/2040
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/DefaultRequestPipeline.java
(right):

http://codereview.appspot.com/23041/diff/3023/2040#newcode92
Line 92: if (!request.getIgnoreCache()) {
On 2009/03/04 05:54:27, panjie.pan wrote:
> If fetchedResponse.isError(), we will cache an error response.

Yes, largely to avoid generating excessive traffic to a backend which is
repeatedly failing. This has been the behavior for quite a while. error
responses have a much shorter TTL in the cache however.

http://codereview.appspot.com/23041/diff/3023/2027
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/InvalidationHandler.java
(right):

http://codereview.appspot.com/23041/diff/3023/2027#newcode72
Line 72: // Assume the the viewer content is being invalidated if it is
available
On 2009/03/04 05:54:27, panjie.pan wrote:
> Why we need to invalidate viewer by default?

This is a convenience when making the call from inside a running gadget.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b