Module: DiasporaFederation::Federation::Sender

Defined in:
lib/diaspora_federation/federation/sender.rb,
lib/diaspora_federation/federation/sender/hydra_wrapper.rb

Overview

Federation logic to send messages to other pods

Defined Under Namespace

Classes: HydraWrapper

Class Method Summary collapse

Class Method Details

.private(sender_id, obj_str, targets) ⇒ Hash

Send a private message to receive-urls

Parameters:

  • sender_id (String)

    sender diaspora-ID

  • obj_str (String)

    object string representation for logging (e.g. type@guid)

  • targets (Hash)

    Hash with receive-urls (key) of peoples with encrypted salmon-xml for them (value)

Returns:

  • (Hash)

    targets to retry



26
27
28
29
30
# File 'lib/diaspora_federation/federation/sender.rb', line 26

def self.private(sender_id, obj_str, targets)
  hydra = HydraWrapper.new(sender_id, obj_str)
  targets.each {|url, json| hydra.insert_enc_magic_env_request(url, json) }
  hydra.send.to_h {|url| [url, targets[url]] }
end

.public(sender_id, obj_str, urls, xml) ⇒ Array<String>

Send a public message to all urls

Parameters:

  • sender_id (String)

    sender diaspora-ID

  • obj_str (String)

    object string representation for logging (e.g. type@guid)

  • urls (Array<String>)

    receive-urls from pods

  • xml (String)

    salmon-xml

Returns:

  • (Array<String>)

    url to retry



14
15
16
17
18
# File 'lib/diaspora_federation/federation/sender.rb', line 14

def self.public(sender_id, obj_str, urls, xml)
  hydra = HydraWrapper.new(sender_id, obj_str)
  urls.each {|url| hydra.insert_magic_env_request(url, xml) }
  hydra.send
end