Commit Graph

563 Commits

Author SHA1 Message Date
Marius f6a5530df8 Integrate LockingStore into UnroutedHandler
The reason behind this drastic move was that sometimes a lock needs to
persist across multiple calls to a DataStore. For example, when a PATCH
request is received, following behaviour is wanted:
	* Obtain lock (LockUpload)
	* Get offset, size etc (GetInfo)
	* Write data (WriteChunk)
	* Release lock (UnlockUpload)
However, before this change, the lock would be release and then obtained again
after the GetInfo and before the WriteChunk call. This resulted in an
inefficient resource usage and even a possible race condition.

The effects of this change was:
* FileLocker is now directly integrated into FileStore and not sperarated
* LockingStore and the entire package has been removed
* MemoryLocker has been moved into its very own package
2015-12-26 21:23:09 +01:00
Marius cfabbf5ffb Extract tests into tusd_test package 2015-12-25 22:33:27 +01:00
Marius 14285e971d Add documentation for FileLocker 2015-12-25 21:33:58 +01:00
Marius b4c0df187e Provide easier way for locking file storage 2015-12-19 00:21:34 +01:00
Marius 83587ca0f8 Add filestore.FileLocker 2015-12-19 00:02:11 +01:00
Marius 8d94d55320 Add package descriptions for documentation 2015-12-18 23:24:12 +01:00
Marius 97f2efb6e5 Rename New to NewMemoryLocker 2015-12-18 23:21:13 +01:00
Marius 47492260e8 Add documentation for MemoryLocker 2015-12-18 23:20:52 +01:00
Marius b03ddd1d4c Add documentation for package lockingstore 2015-12-18 23:13:00 +01:00
Marius 4073f4ae64 Add test for LockingStore 2015-12-15 22:59:58 +01:00
Marius b3fb3a3f5d Ensure MemoryLocker implements Locker in tests 2015-12-15 22:04:12 +01:00
Marius 45936806a9 Add test for lockingstore.MemoryLocker 2015-12-09 20:48:41 +01:00
Marius 49d7c2ff78 Separate locking into data store implementation
The goal is to allow different locking mechanism to be used for different
storages. For example, in-memory for very few uploads, a file locker in
conjunction with the FileStore or an external service, such as ZooKeeper.
2015-12-09 20:25:08 +01:00
Marius 063d4a2442 Add first draft for s3Store 2015-12-08 22:26:37 +01:00
Marius ad5e486ba0 Merge master 2015-12-08 22:08:54 +01:00
Marius 608795b322 Merge pull request #36 from gingermusketeer/expose-handler-methods-v2
Extract basic handlers into unrouted struct
2015-12-08 21:32:56 +01:00
Max Brosnahan 430af02794 Tweak documentation to refer to UnroutedHandler 2015-12-08 10:26:35 +13:00
Max Brosnahan e6f8969399 Handle failure to extract id from url 2015-12-08 09:37:34 +13:00
Max Brosnahan f27c9fd439 Remove dependency on pat for id extraction 2015-12-08 09:10:49 +13:00
Max Brosnahan 218cdfd022 Rename TusMiddleware function to Middleware 2015-12-08 09:10:02 +13:00
Max Brosnahan 12037a8e1d Tweak documentation 2015-12-08 09:09:47 +13:00
Max Brosnahan b36b5ac3bb Extract basic handlers into unrouted struct 2015-12-02 22:19:10 +00:00
Marius dd6ce92651 Ensure an empty body in response to a HEAD request
Addresses #35
2015-12-02 18:59:22 +01:00
Marius 88aed988f9 Ensure empty body in HEAD response 2015-11-26 16:25:59 +01:00
Marius 9a943a4896 Ignore order of metadata in tests 2015-11-26 16:25:34 +01:00
Marius 3812aa7ca2 Add test case for order of termination 2015-11-26 12:43:49 +01:00
Marius 7b1cf1f639 Adjust code style 2015-11-26 12:43:31 +01:00
Marius 38e0a4759b Add documentation for order of termination 2015-11-26 12:43:04 +01:00
anirudt 84ae1cb5b7 modified to private struct 2015-11-25 08:09:58 +05:30
anirudt e135bdde99 fixed bugs 2015-11-25 07:54:36 +05:30
anirudt 57fc14d2f4 used reverse.sort interface 2015-11-25 07:47:31 +05:30
anirudt c2e521e518 fixed index 2015-11-21 09:20:32 +05:30
anirudt 06be13f200 Sorting before termination of uploads
This fix is in limitedstore/limitedstore.go, to intelligently terminate
existing file uploads. The store.uploads map is sorted, and
then analysed to remove the bigger existing uploads first.
2015-11-21 09:02:48 +05:30
Marius 7c7c49f786 Merge pull request #33 from anirudt/master
Fixes typo in datastore.go
2015-11-19 16:35:41 +01:00
anirudt 1e0b37a9a8 Fixes typo in datastore.go
fixes two occurences of the word interpreted
in datastore.go
2015-11-19 19:48:26 +05:30
Marius e445d9c0ef Merge pull request #31 from vayam/master
Allow GET CORS requests, XSS protection and better content type
2015-11-16 21:33:52 +01:00
Naren Venkataraman d87b72e34d Add nosniff header by default 2015-11-15 17:21:57 -05:00
Naren Venkataraman 294b815afb Add OPTIONS back 2015-11-15 17:15:24 -05:00
Naren Venkataraman 04ff76f0ac Add GET,DELETE and remove redundant OPTIONS from Access-Control-Allow-Headers 2015-11-14 12:25:26 -05:00
Naren Venkataraman a48cf931ae Use reason variable 2015-11-14 12:17:52 -05:00
Marius f569ae3f5d Merge pull request #30 from gingermusketeer/fix_race_in_tests
Remove race in patch test
2015-11-11 15:11:52 +01:00
Max Brosnahan 98d8c939c2 Remove race in patch test 2015-11-10 22:16:01 -07:00
Marius 376b73ae4b Merge pull request #28 from gingermusketeer/allow_logger_to_be_configured
Allow logger to be configured
2015-11-09 21:53:10 +01:00
Marius b6b65c5dee Merge pull request #27 from vayam/master
Protocol Conformance + Bug fixes
2015-11-09 21:51:53 +01:00
Max Brosnahan e71b8fb0f3 Allow logger to be configured 2015-11-04 14:42:39 -07:00
Naren Venkataraman 7898128700 Fix tests 2015-11-04 04:56:32 -05:00
Naren Venkataraman db67b862ae s/ErrIllegalOffset/ErrMismatchOffset 2015-11-04 04:37:37 -05:00
Naren Venkataraman e451dc5f65 Make sure Upload-Offset in PATCH request is greater than 0 2015-11-04 04:33:32 -05:00
Naren Venkataraman 1f6aac2a49 Make sure PATCH request has application/offset+octet-stream 2015-11-04 04:23:09 -05:00
Naren Venkataraman 86dc420ebe Fix Content-Length/Body Len Mismatch 2015-11-04 04:16:41 -05:00