This commit is contained in:
Netscape Navigator 2020-04-18 14:51:10 -05:00
parent cc12b91d53
commit fc580010f9
9 changed files with 55 additions and 43 deletions

View File

@ -14,7 +14,7 @@ In the meantime:
git clone https://tildegit.org/PigeonProtocolConsortium/pigeon_ruby.git
cd pigeon_ruby
gem build pigeon.gemspec
gem install pigeon-0.0.4.gem
gem install pigeon-0.0.5.gem
pigeon-cli identity new # Should work. Raise issue if not.
pigeon-cli status
pigeon-cli help
@ -75,22 +75,19 @@ TODO
- [X] Set a max message size.
- [X] Clean up all singletons / .current hacks
- [X] Reduce cross cutting where collaborating objects need access to `@db`
- [X] Ensure all disks writes perform verification!
- [ ] Update README.md. Needs user manual for new `Pigeon::Database` class.
- [ ] Make the switch to LevelDB, RocksDB, [UNQLite](https://unqlite.org/features.html) or similar (currently using Ruby PStore).
- [ ] Make CLI names consistent with API names. Eg: find vs. read.
- [ ] Create regexes in ::Lexer using strings and Regexp.new() for cleaner regexes.
- [ ] Need a way of importing / exporting a feeds blobs. (see "Bundle Brainstorming" below)
- [ ] Need a way of adding peers messages / gossip to bundles. (see "Bundle Brainstorming" below)
- [ ] Check block list before ingesting bundles.
- [ ] Handle the three outcomes of bundle ingestion: `ok`, `blocked`, `already_saved`.
- [ ] add parsers and validators for all CLI inputs
- [ ] Reduce whole darn repo into single module to aide portability. `::Helpers` module is OK.
- [ ] Use URNs instead of multihash?
- [ ] Ensure all disks writes perform verification!
- [ ] Publish a RubyGem
- [ ] Update the bundles.md document once `bundle consume` works.
- [ ] 100% documentation
- [ ] Update spec document CLI usage examples to reflect API changes in 2020.
- [ ] Publish to RubyGems
- [ ] Performance benchmarks (Do this second to last!)
- [ ] Performance tuning (Do this last!)

View File

@ -134,6 +134,12 @@ module Pigeon
def create(file_path = Pigeon::DEFAULT_BUNDLE_PATH)
db.create_bundle(file_path)
end
desc "ingest", "Ingest a pigeon bundle file"
def ingest(file_path = Pigeon::DEFAULT_BUNDLE_PATH)
db.ingest_bundle(file_path)
end
end
class PigeonMessage < ThorBase

View File

@ -1,4 +1,4 @@
#!/usr/bin/env fish
#!/bin/sh
# This is a script that
# run all CLI commands at once
@ -10,84 +10,85 @@ rm -f pigeon.bundle
echo "OK"
echo "Creating new config:"
./pigeon-cli identity new
./pigeon-cli identity show
pigeon-cli identity new
pigeon-cli identity show
echo "Creating kitty cat blobs:"
cat scratchpad.jpg | ./pigeon-cli blob set
cat scratchpad.jpg | pigeon-cli blob set
echo "Adding peers:"
./pigeon-cli peer add @ZMS36YMSTYC19EX8AS07G0XAYEK643YM6SB6NYWATMEBSS92BVH0.ed25519
./pigeon-cli peer add @3EEQ2ETD23DYS1SWBQ373796TR8W865EBWHYAFPBZ8YA2FRCR0YG.ed25519
./pigeon-cli peer add @Y9DG9GZMWJPRW47D0MGMTJNV0PQPFANW7Q5J05PXT0ZNY9PMCZGG.ed25519
./pigeon-cli peer add @WPFKCW2B9SDKBY7NNTVEV7TBZVTEH6J21NXNHQR3006GT1H8PEW0.ed25519
./pigeon-cli peer add @C1KG390SFSZ49P824GNCTP7YF8ZM2SCFGGFBNHBKEKZYGPYTZYX0.ed25519
./pigeon-cli peer add @W1FJYN9ZKZHMBTW8Q8DCVB8YVE5Y7Z896BSM85XEFKXZWPG70W70.ed25519
./pigeon-cli peer add @X5HCRRVH33J0EDJ42JJ193GVA2KDQ9ZW0RQ8RM9MVVPQVXQQC100.ed25519
./pigeon-cli peer add @0Y82485FV56XRBZYT8DRRYPTE36J8NRN5979NE8EXNRMS4JVQMSG.ed25519
pigeon-cli peer add @ZMS36YMSTYC19EX8AS07G0XAYEK643YM6SB6NYWATMEBSS92BVH0.ed25519
pigeon-cli peer add @3EEQ2ETD23DYS1SWBQ373796TR8W865EBWHYAFPBZ8YA2FRCR0YG.ed25519
pigeon-cli peer add @Y9DG9GZMWJPRW47D0MGMTJNV0PQPFANW7Q5J05PXT0ZNY9PMCZGG.ed25519
pigeon-cli peer add @WPFKCW2B9SDKBY7NNTVEV7TBZVTEH6J21NXNHQR3006GT1H8PEW0.ed25519
pigeon-cli peer add @C1KG390SFSZ49P824GNCTP7YF8ZM2SCFGGFBNHBKEKZYGPYTZYX0.ed25519
pigeon-cli peer add @W1FJYN9ZKZHMBTW8Q8DCVB8YVE5Y7Z896BSM85XEFKXZWPG70W70.ed25519
pigeon-cli peer add @X5HCRRVH33J0EDJ42JJ193GVA2KDQ9ZW0RQ8RM9MVVPQVXQQC100.ed25519
pigeon-cli peer add @0Y82485FV56XRBZYT8DRRYPTE36J8NRN5979NE8EXNRMS4JVQMSG.ed25519
echo "removing peers:"
./pigeon-cli peer remove @G28JPBYGNCPE19C32083CDGA0KBKVF5HFJPPDEC8J7CMR3CCBCC0.ed25519
./pigeon-cli peer remove @YWK61TMCZS4WP0R9R3MKKF8HXVJCPTHMXY3NAQH5CQZVCSBRC4V0.ed25519
pigeon-cli peer remove @G28JPBYGNCPE19C32083CDGA0KBKVF5HFJPPDEC8J7CMR3CCBCC0.ed25519
pigeon-cli peer remove @YWK61TMCZS4WP0R9R3MKKF8HXVJCPTHMXY3NAQH5CQZVCSBRC4V0.ed25519
echo "blocking peers:"
./pigeon-cli peer block @5NDF5NSJZCKDGJ5C5EXN4Q4NERXA8QTK3AKJTC9Y5E4K3J42H9E0.ed25519
./pigeon-cli peer block @4MAA3HFRDHFK3H6EEDGE4DTAPP2T7TP2VD8G1X9AHDVXX7AMPA7G.ed25519
./pigeon-cli peer block @41FNE08J5XK9GEV1BTEPT15WW1KDK5XCC8SMM62MQNYZ0785NJ80.ed25519
pigeon-cli peer block @5NDF5NSJZCKDGJ5C5EXN4Q4NERXA8QTK3AKJTC9Y5E4K3J42H9E0.ed25519
pigeon-cli peer block @4MAA3HFRDHFK3H6EEDGE4DTAPP2T7TP2VD8G1X9AHDVXX7AMPA7G.ed25519
pigeon-cli peer block @41FNE08J5XK9GEV1BTEPT15WW1KDK5XCC8SMM62MQNYZ0785NJ80.ed25519
echo "listing all peers:"
./pigeon-cli peer all
pigeon-cli peer all
echo "Making a new `scratch_pad` log entry"
./pigeon-cli draft create scratch_pad
pigeon-cli draft create scratch_pad
echo "Appending values..."
echo "...string via pipe"
echo "my_value" | ./pigeon-cli draft append key1
echo "my_value" | pigeon-cli draft append key1
echo "...string with no quotes"
./pigeon-cli draft append key2 my_value2
pigeon-cli draft append key2 my_value2
echo "...string with quotes"
./pigeon-cli draft append key3 "my_value3"
pigeon-cli draft append key3 "my_value3"
echo "...draft ID"
./pigeon-cli draft append key4 \%4Q7K6A1RW3XEHWFKWTN8SP2M0Q0PXSWPBCFVCZFGM3TAKM6G34SG.sha256
pigeon-cli draft append key4 \%4Q7K6A1RW3XEHWFKWTN8SP2M0Q0PXSWPBCFVCZFGM3TAKM6G34SG.sha256
echo "...blob"
./pigeon-cli draft append key5 \&Y2WZTXD32DNNVPPWVRZ15G2NKTPJTQ6BDW4M14D3NJ38NV3064D0.sha256
pigeon-cli draft append key5 \&Y2WZTXD32DNNVPPWVRZ15G2NKTPJTQ6BDW4M14D3NJ38NV3064D0.sha256
echo "...identity"
./pigeon-cli draft append key6 \@VTE8VPT2S6CM50C2VBPGDHZAP7BWKGZXBVVX0ZPPMDRQ05FV8G80.ed25519
pigeon-cli draft append key6 \@VTE8VPT2S6CM50C2VBPGDHZAP7BWKGZXBVVX0ZPPMDRQ05FV8G80.ed25519
echo "== show draft"
./pigeon-cli draft show
pigeon-cli draft show
echo "== sign (publish, save, commit, etc) draft"
./pigeon-cli draft sign
pigeon-cli draft sign
echo "=== add a second draft to the db"
./pigeon-cli draft create second_test
pigeon-cli draft create second_test
echo "=== append hello:'world' to draft:"
./pigeon-cli draft append hello "world"
pigeon-cli draft append hello "world"
echo "=== Sign draft #2"
./pigeon-cli draft sign
pigeon-cli draft sign
echo "=== Dump the bundle"
./pigeon-cli bundle create
pigeon-cli bundle create
cat pigeon.bundle
echo "=== end bundle dump"
echo "=== end bundle dump. Ingesting bundle..."
pigeon-cli bundle ingest pigeon.bundle
echo "=== find a message"
./pigeon-cli message find (./pigeon-cli message last)
pigeon-cli message find $(pigeon-cli message last)
echo "== find all messages"
./pigeon-cli message find-all
pigeon-cli message find-all
echo "=== getting status:"
./pigeon-cli status
pigeon-cli status

View File

@ -5,7 +5,6 @@ require "set"
module Pigeon
SEED_CONFIG_KEY = "SEED"
VERSION = "0.0.4"
TPL_DIR = File.join(".", "lib", "views")
PIGEON_DB_PATH = File.join("db.pigeon")
@ -197,6 +196,7 @@ module Pigeon
assert("prev", msg.prev, expected_prev)
tpl = msg.template.render_without_signature
Helpers.verify_string(author, signature, tpl)
msg.untaint
msg.freeze
msg
end
@ -211,6 +211,7 @@ module Pigeon
end
end
require_relative File.join("pigeon", "version.rb")
require_relative File.join("pigeon", "local_identity.rb")
require_relative File.join("pigeon", "remote_identity.rb")
require_relative File.join("pigeon", "storage.rb")

View File

@ -30,6 +30,7 @@ module Pigeon
@prev = prev || Pigeon::NOTHING
@lipmaa = lipmaa
@signature = signature
taint
end
def template

View File

@ -101,6 +101,9 @@ module Pigeon
end
def insert_message(msg)
if msg.tainted?
STDERR.puts "WARNING: Just saved an unverified message"
end
write do
return msg if store[MESG_NS][msg.multihash]
insert_and_update_index(msg)

3
lib/pigeon/version.rb Normal file
View File

@ -0,0 +1,3 @@
module Pigeon
VERSION = "0.0.5"
end

Binary file not shown.

View File

@ -1,4 +1,4 @@
require_relative "lib/pigeon"
require_relative "lib/pigeon/version"
Gem::Specification.new do |s|
s.name = "pigeon"