Add peer discovery TODO
[tt.git] / TODO
diff --git a/TODO b/TODO
index 14ce429..5cccb15 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,6 +1,31 @@
+# vim:sw=2:sts=2:
+- [ ] Output formats:
+  - [x] text long
+  - [x] text short
+  - [ ] HTML
+  - [ ] JSON
+- [ ] Convert to Typed Racket
+  - requires: build executable (otherwise too slow)
+- [x] Build executable
+  Implies fix of "collection not found" when executing the built executable
+    outside the source directory:
+
+    collection-path: collection not found
+      collection: "tt"
+      in collection directories:
+      context...:
+       /usr/share/racket/collects/racket/private/collect.rkt:11:53: fail
+       /usr/share/racket/collects/setup/getinfo.rkt:17:0: get-info
+       /usr/share/racket/collects/racket/contract/private/arrow-val-first.rkt:555:3
+       /usr/share/racket/collects/racket/cmdline.rkt:191:51
+       '|#%mzc:p
+
+- [ ] Support redirects
+  - should permanent redirects update the feed somehow?
 - [ ] Support time ranges (i.e. reading the timeline between given time points)
-- [ ] Implement rfc3339->epoch and remove dependency on rfc3339-old
-- [ ] remove dependency on http-client
+- [x] Implement rfc3339->epoch
+- [x] Remove dependency on rfc3339-old
+- [x] remove dependency on http-client
 - [ ] optional text wrap
 - [ ] write
 - [x] caching (use cache by default, unless explicitly asked for update)
     - see timeline ops above
     - see hashtag and channels above
   - [x] d | download
-  - [ ] u | upload
+  - [x] u | upload
     - calls user-configured command to upload user's own feed file to their server
   Looks like a better CLI parser than "racket/cmdline": https://docs.racket-lang.org/natural-cli/
   But it is no longer necessary now that I've figured out how to chain (command-line ..) calls.
 - [ ] Suport immutable timelines
-    - store individual messages (possibly in something like DBM or SQLite)
+    - store individual messages
+      - where?
+        - something like DBM or SQLite - faster
+        - filesystem - transparent, easily published - probably best
+  - [ ] block(chain/tree) of twtxts
+    - distributed twtxt.db
+    - each twtxt.txt is a ledger
+    - peers can verify states of ledgers
+    - peers can publish known nick->url mappings
+    - peers can vote on nick->url mappings
+    - we could break time periods into blocks
+    - how to handle the facts that many(most?) twtxt are unseen by peers
+    - longest X wins?
+- [ ] Peer discovery
+  requires:
+    - parse mentions
+    - parse following
+  rough sketch from late 2019:
+
+        let read file =
+            ...
+        let write file peers =
+            ...
+        let fetch peer =
+            (* Fetch could mean either or both of:
+             * - fetch peer's we-are-twtxt.txt
+             * - fetch peer's twtxt.txt and extract mentioned peer URIs
+             * *)
+            ...
+        let test peers =
+            ...
+        let rec discover peers_old =
+            let peers_all =
+                Set.fold peers_old ~init:peers_old ~f:(fun peers p ->
+                    match fetch p with
+                    | Error _ ->
+                        (* TODO: Should p be moved to down set here? *)
+                        log_warning ...;
+                        peers
+                    | Ok peers_fetched ->
+                        Set.union peers peers_fetched
+                )
+            in
+            if Set.empty (Set.diff peers_old peers_all) then
+                peers_all
+            else
+                discover peers_all
+        let rec loop interval peers_old =
+            let peers_all = discover peers_old in
+            let (peers_up, peers_down) = test peers_all in
+            write "peers-all.txt"  peers_all;
+            write "peers-up.txt"   peers_up;
+            write "peers-down.txt" peers_down;
+            sleep interval;
+            loop interval peers_all
+        let () =
+            loop (Sys.argv.(1)) (read "peers-all.txt")
This page took 0.029627 seconds and 4 git commands to generate.