Use `find_all` when creating bundles
This commit is contained in:
parent
dd7456cc88
commit
8a7eec964a
|
@ -47,11 +47,11 @@ Eg: `pigeon identity show` becomes `./pigeon-cli show`.
|
|||
- [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.
|
||||
- [ ] Fix diagram in spec doc
|
||||
- [ ] refactor `Bundle.create` to use `message find-all`.
|
||||
- [X] Fix diagram in spec doc
|
||||
- [X] refactor `Bundle.create` to use `message find-all`.
|
||||
- [ ] Add Lipmaa links like the Bamboo folks do.
|
||||
- [ ] 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)
|
||||
- [ ] Add Lipmaa links like the Bamboo folks do.
|
||||
- [ ] Add mandatory `--since=` arg to `bundle create`
|
||||
- [ ] Make the switch to LevelDB, RocksDB or similar (currently using Ruby PStore).
|
||||
- [ ] Rename `message find` to `message read`, since other finders return a multihash.
|
||||
|
|
|
@ -2,12 +2,10 @@ module Pigeon
|
|||
class Bundle
|
||||
def self.create(file_path = DEFAULT_BUNDLE_PATH)
|
||||
s = Pigeon::Storage.current
|
||||
last = s.message_count
|
||||
author = Pigeon::LocalIdentity.current
|
||||
range = (0...last).to_a
|
||||
content = range
|
||||
.map { |depth| s.get_message_by_depth(author.multihash, depth) }
|
||||
content = s
|
||||
.find_all(Pigeon::LocalIdentity.current.multihash)
|
||||
.map { |multihash| s.find_message(multihash) }
|
||||
.sort_by(&:depth)
|
||||
.map { |message| message.render }
|
||||
.join(BUNDLE_MESSAGE_SEPARATOR)
|
||||
File.write(file_path, content + CR)
|
||||
|
|
Loading…
Reference in New Issue