]> source.dussan.org Git - jgit.git/commit
LfsProtocolServlet: Add support for rate limit and bandwidth limit errors 14/79314/2
authorDavid Pursehouse <david.pursehouse@gmail.com>
Fri, 19 Aug 2016 01:58:06 +0000 (10:58 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Sat, 20 Aug 2016 02:26:06 +0000 (11:26 +0900)
commit1096652e71257720fcf5bc90ccfa367293bd8ce2
tree8980f653839d3da22e5fd935a3ce4eb5992900ff
parentde89b7d0407507607a3bacc6fb390977713b7495
LfsProtocolServlet: Add support for rate limit and bandwidth limit errors

The git-lfs specification [1] describes the following optional status codes
that may be returned:

429 - The user has hit a rate limit with the server. Though the API does
      not specify any rate limits, implementors are encouraged to set some
      for availability reasons.

509 - Returned if the bandwidth limit for the user or repository has been
      exceeded. The API does not specify any bandwidth limit, but implementors
      may track usage.

Add two new exception classes to represent these cases. Implementations may
throw these from #getLargeFileRepository(), causing the corresponding HTTP
status codes to be returned to the client.

[1] https://github.com/github/git-lfs/blob/master/docs/api/v1/http-v1-batch.md

Change-Id: I7b93f3cf90f7344c90b1587e07927fdeb167097e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/errors/LfsBandwidthLimitExceeded.java [new file with mode: 0644]
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/errors/LfsRateLimitExceeded.java [new file with mode: 0644]