Remove singleton usage in ::Storage

This commit is contained in:
Netscape Navigator 2020-04-15 08:06:24 -05:00
commit bd34ce89c7
4 changed files with 3 additions and 8 deletions

View File

@ -57,6 +57,7 @@ Eg: `pigeon identity show` becomes `./pigeon-cli show`.
- [X] Add Lipmaa links like the Bamboo folks do. - [X] Add Lipmaa links like the Bamboo folks do.
- [X] Set a max message size. - [X] Set a max message size.
- [ ] Update README.md. Needs user manual for new `Pigeon::Database` class. - [ ] Update README.md. Needs user manual for new `Pigeon::Database` class.
- [ ] Remove all `.current` "singletons" / hacks
- [ ] Make the switch to LevelDB, RocksDB, [UNQLite](https://unqlite.org/features.html) or similar (currently using Ruby PStore). - [ ] 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. - [ ] Make CLI names consistent with API names. Eg: find vs. read.
- [ ] Create regexes in ::Lexer using strings and Regexp.new() for cleaner regexes. - [ ] Create regexes in ::Lexer using strings and Regexp.new() for cleaner regexes.
@ -66,7 +67,6 @@ Eg: `pigeon identity show` becomes `./pigeon-cli show`.
- [ ] Check block list before ingesting bundles. - [ ] Check block list before ingesting bundles.
- [ ] Handle the three outcomes of bundle ingestion: `ok`, `blocked`, `already_saved`. - [ ] Handle the three outcomes of bundle ingestion: `ok`, `blocked`, `already_saved`.
- [ ] add parsers and validators for all CLI inputs - [ ] add parsers and validators for all CLI inputs
- [ ] Remove all `.current` "singletons" / hacks
- [ ] Reduce whole darn repo into single module to aide portability. `::Helpers` module is OK. - [ ] Reduce whole darn repo into single module to aide portability. `::Helpers` module is OK.
- [ ] Use URNs instead of multihash? - [ ] Use URNs instead of multihash?
- [ ] Ensure all disks writes perform verification! - [ ] Ensure all disks writes perform verification!

View File

@ -68,7 +68,6 @@ module Pigeon
PREV = /prev (#{MESG_VALUE}|#{NULL_VALUE})\n/ PREV = /prev (#{MESG_VALUE}|#{NULL_VALUE})\n/
KIND = /kind #{ALPHANUMERICISH}\n/ KIND = /kind #{ALPHANUMERICISH}\n/
BODY_ENTRY = /#{ALPHANUMERICISH}:#{ANY_VALUE}\n/ BODY_ENTRY = /#{ALPHANUMERICISH}:#{ANY_VALUE}\n/
FOOTER_ENTRY = /signature .*{103}\.sig\.ed25519\n?/ FOOTER_ENTRY = /signature .*{103}\.sig\.ed25519\n?/
LEXER_STATES = [HEADER = :header, BODY = :body, FOOTER = :footer] LEXER_STATES = [HEADER = :header, BODY = :body, FOOTER = :footer]

View File

@ -65,13 +65,11 @@ module Pigeon
end end
def find_all(author) def find_all(author)
# TODO: Ability to pass an author ID to `find-all`
store = Pigeon::Storage.current
all = [] all = []
depth = -1 depth = -1
last = "" last = ""
until (last == nil) || (depth > 999999) until (last == nil) || (depth > 99999)
last = store.get_message_by_depth(author, depth += 1) last = self.get_message_by_depth(author, depth += 1)
all.push(last) if last all.push(last) if last
end end
return all return all

View File

@ -93,8 +93,6 @@ RSpec.describe Pigeon::Message do
expect(m4.prev).to be expect(m4.prev).to be
end end
it "verifies accuracy of Lipmaa links"
it "does not allow message with more than 64 keys" do it "does not allow message with more than 64 keys" do
error = "Messages cannot have more than 64 keys. Got 65." error = "Messages cannot have more than 64 keys. Got 65."
body = {} body = {}