summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-12-12[refactor] introduces a GenericWriterVictor Shyba
AESWriter and HMACWriter are just applying hmac or aes into a flow of data. Abstracted the application of those operations into a super class and highlighted just the difference on each implementation.
2016-12-12[refactor] adds PipeableWriter to pipe two streamsVictor Shyba
VerifiedEncryptor and VerifiedDecryptor are just a pipe and a fan-out. This class provides both behaviors to two distinct writeable things.
2016-12-12[refactor] simplify _cryptoVictor Shyba
After adding the streaming decrypt, some classes were doing almost the same thing. Unified them. Also fixed some module level variables to upper case and some class name to camel case.
2016-12-12[refactor] improve loggingVictor Shyba
Some exceptions were missing a proper description and client_side_db.py script wasn't capturing logs from Twisted.
2016-12-12[bug] make the semaphore cover all parsingVictor Shyba
Unfortunately, if a doc finishes decryption before the previous one we will still have an issue while inserting. This commits solves it by adding the parse and decrypt inside of the semaphore.
2016-12-12[feature] make _crypto stream on decryptionVictor Shyba
We are already doing this on encryption, now we can stream also from decryption. This unblocks the reactor and will be valuable for blobs-io.
2016-12-12[feature] delimit preamble from ciphertextVictor Shyba
We now encode preamble and ciphertext+hmac in two distinct payloads separated by a space. This allows metadata to be extracted and used before decoding the whole document. It also introduces a single packer for packing and unpacking of data instead of reads and writes. Downside: doc_id and rev are limited to 255 chars now.
2016-12-12[refactor] Hide IV, simplify some callsVictor Shyba
IV was being set during tests and this required some defensive coding to avoid IV being set in production. This commits makes the test use the generated IV and "hides" it using a read-only property to let it clear this should never happen. Also refactored out some parameters that are generated automatically to reduce some lines of code and enhance readability.
2016-12-12[docs] add docstrings for _cryptoVictor Shyba
Also explaining how we are using Twisted's consumer interfaces.
2016-12-12[refactor] separate server application into another filedrebs
2016-12-12[refactor] remove dead parameters, improve commentsVictor Shyba
received docs makes no sense for a single request download, plus all its comments and docstrings. Also updated docstrings for other methods. The method that tests if sqlcipher is encrypted can return a db handle that can be used right away. If we ignore it and reopen we can end up with a lost open cursor.
2016-12-12[refactor] Remove dead codeVictor Shyba
Batching is now decided on server side, so the code can be simplified. Also, sync_db and other parameters were used to initialize encdecpool, which is no longer supported.
2016-12-12[bug] emit last sent doc eventVictor Shyba
Document sending happens after encryption, so the last sent document needs to be signalled after request end.
2016-12-12[tests] fixes test_crypto benchVictor Shyba
encrypt returns a deferred and needs the adapted benchmark runner.
2016-12-12[tests] use options instead of marksVictor Shyba
When we use marks the new pytests from benchmarks folder are collected and ignored, but this causes trial to fail sometimes. Using --ignore avoids it from being loaded while --benchmark-only will properly select the benchmarks for tox, as intended.
2016-12-12[bug] fix upload progressVictor Shyba
We need to emit zmq status during doc prepare, which is called during upload.
2016-12-12[tests] migrate pytest to trialVictor Shyba
test_deprecated_crypto was using pytest, which unfortunately doesnt work when mixed with trial. Migrated back. Also added norecursedirs option back, as it is necessary for parallel testing mode.
2016-12-12[test] rename benchmark tests directory and tagdrebs
2016-12-12[test] add test for deprecated crypto format updatedrebs
2016-12-12[test] move fixtures one level updrebs
2016-12-12[test] use tags for selecting benchmark testsdrebs
2016-12-12[test] remove unneeded setting of environment variablesdrebs
2016-12-12[style] fix pep8 and confsVictor Shyba
Fixes setup.cfg, adding current exclude rules, simplified tox.ini to use setup.cfg and fixed all.
2016-12-12[bug] include_deleted=True on syncVictor Shyba
Also refactored tests and code to stop relying on old parameters which included docs instead of get_doc calls.
2016-12-12[refactor] better naming for producer callingVictor Shyba
Giving the proper name to the function and arguments helps to make the producer wizardry less magic.
2016-12-12[pkg] add six and cryptographyVictor Shyba
Those are already present, but we are using the ones coming from our dependencies. Explicit is better than implicit.
2016-12-12[tests] remove test_sync_deferredVictor Shyba
Deferred encryption option is gone.
2016-12-12[style] explicit unlimited request sizeVictor Shyba
Request size on a stream can't be measured upfront and a limit doesn't make much sense. The real limit is user's Quota, to be implemented.
2016-12-12[style] improve comments for sync.pyVictor Shyba
2016-12-12[refactor] simplify content as a new lineVictor Shyba
Code was complex and raised a flag during review.
2016-12-12[refactor] improve readability of stream producerVictor Shyba
2016-12-12[style] add license headerVictor Shyba
2016-12-12[refactor] remove assert logic from fetch_protocolVictor Shyba
Asserts aren't a good solution for stream parsing, its cleaner to check and raise in place. Also, asserts can be ignored.
2016-12-12[feature] Adds back support to deprecated cryptoVictor Shyba
Will be removed when we have the proper tool to migrate data.
2016-12-12[feature] Adds deprecated crypto moduleVictor Shyba
This is supposed to be used only for temporary backwards compatibility, while we develop a proper migration tool.
2016-12-12[refactor] simplify server insertVictor Shyba
Moved out magic numbers into a constant and simplified logic during doc upload.
2016-12-12[tests] remove test_sync_very_large_filesVictor Shyba
We have benchmarks now to test sync limits and 100mb is too far from current needs.
2016-12-12[tests] improve doc creation on benchmarksVictor Shyba
If we create all at once we cant test higher loads because it will try to hold all in memory at the same time. Also, this code is smaller and more readable.
2016-12-12[refactor] stop using a dict for syncersVictor Shyba
A dict was used to store references for the synchronizers based on a URL. This commit removes it as it doesnt make sense with current code.
2016-12-12[tests] fall back to TestCase classesVictor Shyba
This test was using pytest, but it was making other trial based tests fail. I couldn't figure out why, but falling back to TestCase solved it.
2016-12-12[refactor] stop using leap.common.httpVictor Shyba
We aren't using leap.common.http implementation and we need specific features from original Twisted Web Agent. This commit implements it on HTTP Targer.
2016-12-12[bug] total number of documentsVictor Shyba
Parsing from metadata we can store the total of docs and handle it for the doc parser in order to be able to keep consistent events info.
2016-12-12[refactor] Issues from code reviewVictor Shyba
2016-12-12[refactor] more comments, less codeVictor Shyba
Some code were duplicated, got removed. Additional comments added for documenting such a critical and complex part as a protocol.
2016-12-12[refactor] DocStreamReceiver <- ReadBodyProtocolVictor Shyba
Both classes holds u1db error handling. Making DocStreamReceiver a subclass reduces the error handling to a single place thus removing duplicated code.
2016-12-12[bug] defer insertion to threads during downloadVictor Shyba
Insertion is synchronous and blocks the reactor. That's a temporary solution as we used to have on decpool.
2016-12-12[style] remove unused imports (pep8)Victor Shyba
2016-12-12[test] fix test and remove leftovers defer_encryptionVictor Shyba
2016-12-12[bug] fix importKali Kaneko
2016-12-12[bug] remove print debug statementsKali Kaneko