Commit graph

171 commits

Author SHA1 Message Date
Trolli Schmittlauch 00ff2bf071 refactor adding neighbours 2020-06-19 19:15:05 +02:00
Trolli Schmittlauch e898b80762 Merge branch 'refactorSuccessorsPredecessors' into dhtNetworking 2020-06-19 18:31:39 +02:00
Trolli Schmittlauch 3f42f98443 adjust lookup to RingMap, fix #48
- change default lookup result when not joined to FOUND
- fix determining own responsibility #48
- adjust tests
2020-06-18 23:08:20 +02:00
Trolli Schmittlauch da0b8626cb critical bug fix: use target ID for predecessor query lookup 2020-06-18 23:06:43 +02:00
Trolli Schmittlauch f27812bcf3 give up on providing type signature for takeEntriesUntil 2020-06-17 15:13:49 +02:00
Trolli Schmittlauch 43e4ab184e adjust cache entry insertion to usage of RingMap
#48
2020-06-17 14:53:36 +02:00
Trolli Schmittlauch fb164dea0a fix instance declaration of RingMap 2020-06-17 14:32:26 +02:00
Trolli Schmittlauch 7e08250f8c refactor setting successors and predecessors 2020-06-17 14:29:30 +02:00
Trolli Schmittlauch 2269357ed0 deleting RingMap entries, list conversion 2020-06-17 02:21:37 +02:00
Trolli Schmittlauch 6142ee61d7 WIP: implement adding, setting and taking RingMap entries.
contributes to #48
2020-06-16 23:51:53 +02:00
Trolli Schmittlauch 22a6becf6b fix all previously working tests 2020-06-15 16:41:11 +02:00
Trolli Schmittlauch 061bce2b08 adjust types to refactored RingMap NodeCache 2020-06-15 15:14:11 +02:00
Trolli Schmittlauch 6a98b5c6da fix RingMap function types 2020-06-15 13:53:06 +02:00
Trolli Schmittlauch b179357ab0 generalise NodeCache implementation to make it usable for neighbour nodes as well
contributes to #48
2020-06-13 21:41:32 +02:00
Trolli Schmittlauch 2739b47162 send stabilise to certain successor or predecessor 2020-06-12 15:49:12 +02:00
Trolli Schmittlauch 1204457a2a make sure that predecessors are smaller and successors are larger than node ID 2020-06-10 16:53:17 +02:00
Trolli Schmittlauch 2c98d8507d implement stabilise request sending and parsing
contributes to #44
2020-06-09 22:11:42 +02:00
Trolli Schmittlauch f15d83baff Refactor predecessors and successors to hold RemoteNodeStates
- neighbour nodes need to be contacted reliably
- Only holding NodeIDs requires a cache lookup for getting hostname and
  port. This is brittle as the entry could've been purged from cache.
- refactored ASN.1 scheme, types and add/ sort/ remove implementations

closes #46
2020-06-09 15:21:22 +02:00
Trolli Schmittlauch 67cba1b69b fixup! rename responseTo -> requestID to avoid partial record accessors 2020-06-08 23:18:12 +02:00
Trolli Schmittlauch 4e359775ec add some debug output prints 2020-06-08 20:31:22 +02:00
Trolli Schmittlauch 2c827ea326 rename responseTo -> requestID to avoid partial record accessors 2020-06-08 20:31:18 +02:00
Trolli Schmittlauch 3892dc91aa Merge branch 'mainline' into dhtNetworking 2020-06-08 18:58:23 +02:00
Trolli Schmittlauch 7c87a578d3 move Main executable to app/ closes #18 2020-06-08 18:57:53 +02:00
Trolli Schmittlauch 6699237243 respond to and handle QueryID requests
closes #28
2020-06-08 00:36:59 +02:00
Trolli Schmittlauch eec751584c make setPredecessors and setSuccessors enforce the ordering + size limit
closes #47
2020-06-07 23:45:28 +02:00
Trolli Schmittlauch 0a9b0547c6 forgot handling the successors and predecessors of the leaving node
contributes to #28
2020-06-07 00:21:14 +02:00
Trolli Schmittlauch e00da9b84f respond to and handle Leave requests
contributes to #28
2020-06-06 18:02:55 +02:00
Trolli Schmittlauch 53308080db respond to Stabilise requests 2020-06-06 17:31:20 +02:00
Trolli Schmittlauch 43d72128d2 respond to Ping requests 2020-06-06 17:05:54 +02:00
Trolli Schmittlauch e32f0c9146 process and respond to join requests
- serialiseMessage now starts numbering parts from the first number it
  gets, to be able to continue responding after having ACKed previous
  parts

contributes to #28
2020-06-06 13:45:18 +02:00
Trolli Schmittlauch 914e07a412 change NodeCache protection to STM
- putting the NodeCache behind an IORef had been chose because those
  could've been read non-blocking
- the same is true for TVars. The performance characteristics are likely
  worse, but at the advantage of composability within STM monads
2020-06-05 22:07:47 +02:00
Trolli Schmittlauch dc2e399d64 protect concurrent node state access with STM
- for allowing concurrent access to predecessors and successors, the
  whole LocalNodeState is passed wrapped into an STM TVar
- this allows keeping the tests for the mostly pure data type, compared
  to protecting only the successor and predecessor list

contributes to #28
2020-06-04 22:31:41 +02:00
Trolli Schmittlauch f42dfb2137 dispatch incoming requests to their response functions
- contributes to #28
2020-06-04 14:48:05 +02:00
Trolli Schmittlauch 0660bce299 acknowledge parts when receiving partial requests 2020-05-31 23:21:55 +02:00
Trolli Schmittlauch 88104de9bf periodically purge request parts 2020-05-31 21:07:40 +02:00
Trolli Schmittlauch bcd1c34c7c manage incoming request parts before handling 2020-05-31 01:14:09 +02:00
Trolli Schmittlauch 2542091379 adjust rest of code to new message structure 2020-05-30 13:52:06 +02:00
Trolli Schmittlauch f8d444d5b6 FediChordMessage: last part has falg instead of parts number in each msg
Motivation: Including the number of parts in each message part requires
the total number of parts to be known in advance, making dynamic
responses based on the received data difficult
2020-05-30 13:07:28 +02:00
Trolli Schmittlauch fea9660f80 WIP: start implementing incoming request handling 2020-05-30 01:10:56 +02:00
Trolli Schmittlauch 61818c58a9 main server thread structure 2020-05-29 17:39:35 +02:00
Trolli Schmittlauch b4ecf8b0aa catch and handle more join errors 2020-05-27 23:37:32 +02:00
Trolli Schmittlauch 6ff765c63e catch and handle bootstrap join errors 2020-05-27 18:59:38 +02:00
Trolli Schmittlauch 27e5c5f9ce bracket all socket-using operations to avoid resource leakage 2020-05-27 18:08:46 +02:00
Trolli Schmittlauch b1c5c5e5f4 try all bootstrap nodes until successfully joined 2020-05-26 20:54:02 +02:00
Trolli Schmittlauch 702684b1a9 split fediChordJoin into general purpose and bootstrapping part 2020-05-26 11:02:29 +02:00
Trolli Schmittlauch 43eb04dfea preliminary passing of bootstrap nodes in Main to fediChordJoin 2020-05-26 09:39:02 +02:00
Trolli Schmittlauch ad1465c5fe use global cache adding function 2020-05-26 08:55:44 +02:00
Trolli Schmittlauch e3bfa26ddb join request + large FediChord refactoring
- implement sending of initial join request sending, response parsing
  and cache population (untested but compiles)
- refactor basic types and their functions into Hash2Pub.FediChordTypes
  to prevent import loops, leaving Hash2Pub.FediChord to contain the
  high level actions called from Main
2020-05-25 22:03:24 +02:00
Trolli Schmittlauch d5841d13fd extract queryID message sending function so it can be used for first join 2020-05-22 22:12:38 +02:00
Trolli Schmittlauch e8091b0a29 change all function definitions to new NodeState types
- adjust implementation

contributes to #20
2020-05-21 23:48:36 +02:00
Trolli Schmittlauch fe673dc255 make NodeState a typeclasse, define setters and getters on its representations
contributes to #20
2020-05-21 23:40:10 +02:00
Trolli Schmittlauch 99a2b0ba09 add instance deriving instructions 2020-05-20 19:27:51 +02:00
Trolli Schmittlauch f6c252d314 sending a queryID request compiles (untested) 2020-05-20 18:55:24 +02:00
Trolli Schmittlauch beffab99a0 clarify counting of FediChordMessage parts 2020-05-19 19:50:36 +02:00
Trolli Schmittlauch c31baa3635 run stylish 2020-05-19 17:55:40 +02:00
Trolli Schmittlauch 8d18f952cd implement send-receive-acknowledge-retry loop for requests 2020-05-19 17:53:13 +02:00
Trolli Schmittlauch 0e6f126b3b Merge branch 'master' into dhtNetworking 2020-05-19 16:51:43 +02:00
Trolli Schmittlauch 84bcd676ae move protocol data definitions to own module to prevent cyclic imports 2020-05-19 16:30:56 +02:00
Hécate 41e999ed99 Linting integration
This commit brings in an HLint configuration file
and several recommended modifications such as:

* End-of-line extra spaces removal;
* Import lines ordering;
* Redundant $ removal;
* Generalisation of ++ and map to <> and fmap;
* Preferring `pure` over `return`;
* Removing extraenous extensions.

And finally, a `stylish-haskell` helper script
that detects if code files are dirty. Can be useful for CI,
although manually calling it can be nice if you would rather
first implement then beautify.
2020-05-19 12:42:06 +02:00
Trolli Schmittlauch 60c164dbb0 remove unnecessary directory level 2020-05-19 00:01:32 +02:00
Trolli Schmittlauch 8b01ad2f37 remove unnecessary directory level 2020-05-17 21:31:44 +02:00
Trolli Schmittlauch 21fef145a0 working project structure with tests
- restructured project again: splitting into executable and Hash2Pub
  library
- placeholder test file is successfully compiled and run
2020-05-17 21:31:43 +02:00
Trolli Schmittlauch 30cfed81ea restructure nix development environment, now with Hoogle 2020-05-17 21:31:43 +02:00
Trolli Schmittlauch 6329f815d1 Initial packaging as a Cabal package, in preparation for #2
- also restructures shell.nix to parse cabal file instead of directly
  specifying dependencies
2020-05-17 21:31:43 +02:00
Trolli Schmittlauch 3b3ee09575 fix Haddock documentation, contrinutes to #8 2020-05-17 21:31:43 +02:00
Trolli Schmittlauch 08932cf80a selectively export only needed constructors 2020-05-17 21:31:43 +02:00
Trolli Schmittlauch 4a89ffe25a improve documentation, contributes to #8 2020-05-17 21:31:43 +02:00
Trolli Schmittlauch 3f9452ab7e choose and implement data structures for node state and cache 2020-02-27 22:10:57 +01:00
Trolli Schmittlauch ce4cc385b8 rename whole project and make DHT implementation as a project specific module 2020-02-26 14:11:33 +01:00
Trolli Schmittlauch 6c5faa4fc6 rename DHT implementation as it deviates from the EpiChord paper 2020-02-24 22:56:03 +01:00
Trolli Schmittlauch e83710f10b Start implementing the Epichord DHT: NodeID type 2020-02-24 21:53:47 +01:00