Pigeon-Ruby/README.md

146 lines
6.8 KiB
Markdown
Raw Normal View History

2019-10-10 00:32:54 +00:00
![](logo.png)
2019-09-22 02:30:03 +00:00
# Pigeon Ruby
This is a WIP [Pigeon Protocol](https://tildegit.org/PigeonProtocolConsortium/protocol_spec) client written in Ruby.
2019-09-22 02:30:03 +00:00
2020-04-19 21:27:09 +00:00
# Caveats
* Probably does not work on Windows, but testers are welcome to try it out. Please let me know how it goes.
2020-04-20 02:32:37 +00:00
* Blobs are not included in bundles yet.
2020-04-19 21:27:09 +00:00
* Not published to RubyGems yet (see installation instructions below)
* Not thread safe, never will be. This implementation is intended for a single user and makes many design tradeoffs around that use case.
2020-04-20 02:32:37 +00:00
* Bundle works, but is inefficient. Will optimize after proof of concept.
2020-04-19 21:27:09 +00:00
2020-04-18 15:51:08 +00:00
# Installation
2019-09-22 02:30:03 +00:00
2020-04-18 18:18:00 +00:00
We are not yet on Rubygems. The gem will be released after we are fully compliant with the spec and have high test coverage stats.
2019-09-22 02:30:03 +00:00
2020-04-18 16:05:19 +00:00
In the meantime:
```
git clone https://tildegit.org/PigeonProtocolConsortium/pigeon_ruby.git
cd pigeon_ruby
2020-04-18 18:18:00 +00:00
gem build pigeon.gemspec
2020-04-19 22:37:29 +00:00
gem install pigeon-0.0.7.gem
2020-04-18 18:18:00 +00:00
pigeon-cli identity new # Should work. Raise issue if not.
pigeon-cli status
pigeon-cli help
2020-04-18 16:05:19 +00:00
```
2020-04-18 15:51:08 +00:00
# Usage: CLI
2020-04-18 18:18:00 +00:00
See `pigeon-cli help` for documentation.
See `kitchen_sink.sh` examples.
2019-09-22 02:30:03 +00:00
2020-04-18 15:51:08 +00:00
# Usage: Ruby Lib
2020-04-18 16:05:19 +00:00
TODO
2019-09-22 02:30:03 +00:00
# Current Status
- [X] pigeon identity new
- [X] pigeon identity show
- [X] pigeon status
2019-09-22 02:31:01 +00:00
- [X] pigeon blob set
2019-09-22 11:00:19 +00:00
- [X] pigeon blob get
- [X] pigeon peer add
- [X] pigeon peer remove
- [X] pigeon peer block
2019-09-25 01:31:32 +00:00
- [X] pigeon peer all
- [X] 100% coverage
- [X] Convert `".sig.ed25519"` literals to constants
- [X] Rename numerous "pigeon message ..." commands to "pigeon draft ..."
2020-03-14 03:41:31 +00:00
- [X] pigeon draft create
- [X] pigeon draft append
- [X] pigeon draft current
- [X] pigeon draft save
- [X] pigeon bundle create
- [X] Use JSON.stringify() for string keys (instead of `inspect`)
- [X] Move literals into `Pigeon` module as constants, again.
- [X] pigeon message find
- [X] pigeon message find-all for local feed.
2020-03-31 12:30:44 +00:00
- [X] pigeon bundle consume (We are minimally feature complete at this point)
- [X] Fix the diagram in the spec document
2020-04-02 12:32:21 +00:00
- [X] Validate inputs for `Draft#[]=`.
- [X] Put all the [HEADER, string, FOOTER].join("") nonsense into Pigeon::Helpers
- [X] Use raw SHA256 hashes for blob multihashes, not hex.
- [X] Change all the `{40,90}` values in ::Lexer to real length values
2020-04-03 10:19:42 +00:00
- [X] Don't double-ingest messages. It will screw up indexes.
2020-04-03 10:35:48 +00:00
- [X] 100% test coverage
- [X] Implement pigeon message find-all for peer feed. I will need to add index for `author => message_count`
- [X] Switch to Crockford base32- Simplifies support for legacy systems. Easy to implement.
- [X] Fix `scratchpad.sh` to use Base32
- [X] Rename (RemoteIdentity|LocalIdentity)#public_key to #multihash for consistency with other types.
2020-04-06 12:32:19 +00:00
- [X] Fix diagram in spec doc
- [X] refactor `Bundle.create` to use `message find-all`.
- [X] Rename `message find` to `message read`, since other finders return a multihash.
2020-04-09 13:14:50 +00:00
- [X] Message.ingest should be the only code path to message authoring.
2020-04-09 13:15:00 +00:00
- [X] Don't allow any type of whitespace in `kind` or `string` keys. Write a test for this.
- [X] Run Flog / Flay and friends to find duplications. Will aid in port to other languages.
- [X] Make all methods private except those required for the CLI.
2020-04-14 13:21:51 +00:00
- [X] Add Lipmaa links like the Bamboo folks do.
2020-04-15 12:30:05 +00:00
- [X] Set a max message size.
2020-04-18 15:51:08 +00:00
- [X] Clean up all singletons / .current hacks
- [X] Reduce cross cutting where collaborating objects need access to `@db`
2020-04-18 19:51:10 +00:00
- [X] Ensure all disks writes perform verification!
- [X] Make CLI names consistent with API names. Eg: find vs. read.
- [X] `find-all` should....find all. Currently finds your messages or maybe peers, but not all.
- [X] Add log count to `pigeon-cli status`
2020-04-20 02:32:37 +00:00
- [X] Delete `Draft#put` entirely.
- [X] Check block list before ingesting bundles.
2020-04-22 13:21:55 +00:00
- [X] Need a way of importing / exporting a feeds blobs. (see "Bundle Brainstorming" below)
- [X] Need a way of adding peers messages / gossip to bundles. (see "Bundle Brainstorming" below)
2020-04-25 15:11:25 +00:00
- [X] Rename `who_am_i` as `get_who_am_i` to follow VERB + NOUN convention.
- [ ] Find that non-deterministic runaway loop in the test suite.
- [ ] Update README.md / tutorial.rb (user manual for `Pigeon::Database`).
2020-04-22 13:21:55 +00:00
- [ ] Update spec document CLI usage examples to reflect API changes in 2020.
- [ ] Publish to RubyGems
# Optimizations
2020-03-15 18:12:26 +00:00
- [ ] add parsers and validators for all CLI inputs
2020-04-22 13:21:55 +00:00
- [ ] Make the switch to LevelDB, RocksDB, [UNQLite](https://unqlite.org/features.html) or similar (currently using Ruby PStore).
- [ ] Convert literals to constants, remove unused locals, reduce duplication, run linter.
- [ ] Reduce whole darn repo into single module to aide portability. `::Helpers` module is OK.
- [ ] Update the bundles.md document once `bundle consume` works.
2020-04-03 10:35:48 +00:00
- [ ] 100% documentation
- [ ] Performance benchmarks (Do this second to last!)
- [ ] Performance tuning (Do this last!)
2020-04-08 13:54:28 +00:00
2020-04-15 13:09:49 +00:00
# After v0.0.1
2020-04-08 13:54:28 +00:00
2020-04-15 13:09:49 +00:00
- [ ] (later, not now) Support partial verification via `lipmaa` property.
- [ ] Add mandatory `--since=` arg to `bundle create
2020-04-20 02:32:37 +00:00
- [ ] Interest and Disinterest Signalling for document routing: Create a `$blob_status` message to express `have`, `want` signalling. This can steer bundle creation and an eventual `--for` flag at bundle creation time to customize a bundle to a particular user.
- [ ] Add a schema for `$peer_status`. Eg: `block`, `unblock`, `follow`, `unfollow`.
# Idea Bin
2020-04-18 15:51:08 +00:00
- [ ] Map/reduce plugin support for custom indices?
- [ ] Ability to add a blob in one swoop using File objects and `Message#[]=`, maybe?
- [ ] Bundling via [Optar](http://ronja.twibright.com/optar/) or [Colorsafe](https://github.com/colorsafe/colorsafe)
2020-04-04 22:35:07 +00:00
2020-04-05 20:31:44 +00:00
# New Bundle Format
2020-04-04 22:35:07 +00:00
2020-04-05 20:31:44 +00:00
We have a bundle format that works, but it only exports messages.
2020-04-04 22:35:07 +00:00
2020-04-05 20:31:44 +00:00
We need a bundle format that may optionally include blobs as well.
2020-04-04 22:35:07 +00:00
2020-04-05 20:31:44 +00:00
Here's how we will support that:
2020-04-04 22:35:07 +00:00
1. Create a `bundle_X/` directory. The name is arbitrary and can be defined by the user.
2. In the root directory of `bundle_x/`, a single `messages.pgn` file contains all messages.
* All messages are expected to be sorted by depth
2020-04-05 20:31:44 +00:00
* Messages from multiple authors may be included in a single bundle, but the messages must appear in the correct order with regards to the `depth` field.
2020-04-04 22:35:07 +00:00
3. Blobs are stored in a very specific hierarchy to maintain FAT compatibility:
2020-04-22 13:21:55 +00:00
* `blobs/bundle/7Z2CSZK/MB1RE5G/6SKXRZ6/3ZGCNP8/VVEM3K0/XFMYKET/RDQSM5W.BSG`
2020-04-04 22:35:07 +00:00
2020-04-05 20:31:44 +00:00
Additional notes:
2020-04-04 22:35:07 +00:00
* It is recommended to compress bundles (ex: *.zip files) but these concerns are not handled by the protocol currently.
# Unanswered Questions
* PEER MESSAGES: I want to add a `--depth` option to bundle exports that would only return messages after the `nth` sequence number. It would not make sense to apply `--depth` to all peer messages in the bundle. It would not be practical to expect the user to provide a `--depth` for every peer every time a bundle is generated.
2020-04-19 16:16:04 +00:00
* Create a new `received_on` index that records the local user's `depth` at the time of ingestion?