lib/zold/node/pipeline.rb
def push(id, body, wallets, log)
      start = Time.now
      copies = Copies.new(File.join(@copies, id.to_s))
      host = '0.0.0.0'
      copies.add(body, host, Remotes::PORT, 0)
      unless @remotes.all.empty?
        Fetch.new(
          wallets: wallets, remotes: @remotes, copies: copies.root, log: log
        ).run(['fetch', id.to_s, "--ignore-node=#{@address}", "--network=#{@network}", '--quiet-if-absent'])
      end
      modified = merge(id, copies, wallets, log)
      Clean.new(wallets: wallets, copies: copies.root, log: log).run(
        ['clean', id.to_s, '--max-age=1']
      )
      copies.remove(host, Remotes::PORT)
      if modified.empty?
        log.info("Accepted #{id} in #{Age.new(start, limit: 1)} and not modified anything")
      else
        log.info("Accepted #{id} in #{Age.new(start, limit: 1)} and modified #{modified.join(', ')}")
      end
      modified << id if copies.all.count > 1
      modified
    end
def push(id, body, wallets, log)
      start = Time.now
      copies = Copies.new(File.join(@copies, id.to_s))
      host = '0.0.0.0'
      copies.add(body, host, Remotes::PORT, 0)
      unless @remotes.all.empty?
        Fetch.new(
          wallets: wallets, remotes: @remotes, copies: copies.root, log: log
        ).run(['fetch', id.to_s, "--ignore-node=#{@address}", "--network=#{@network}", '--quiet-if-absent'])
      end
      modified = merge(id, copies, wallets, log)
      Clean.new(wallets: wallets, copies: copies.root, log: log).run(
        ['clean', id.to_s, '--max-age=1']
      )
      copies.remove(host, Remotes::PORT)
      if modified.empty?
        log.info("Accepted #{id} in #{Age.new(start, limit: 1)} and not modified anything")
      else
        log.info("Accepted #{id} in #{Age.new(start, limit: 1)} and modified #{modified.join(', ')}")
      end
      modified << id if copies.all.count > 1
      modified
    end
def push ( id , body , wallets , log ) start = Time . now copies = Copies . new ( File . join ( @copies , id . to_s ) ) host = '0.0.0.0' copies . add ( body , host , Remotes :: PORT , 0 ) unless @remotes . all . empty? Fetch . new ( wallets : wallets , remotes : @remotes , copies : copies . root , log : log ) . run ( [ 'fetch' , id . to_s , "--ignore-node=#{@address}" , "--network=#{@network}" , '--quiet-if-absent' ] ) end modified = merge ( id , copies , wallets , log ) Clean . new ( wallets : wallets , copies : copies . root , log : log ) . run ( [ 'clean' , id . to_s , '--max-age=1' ] ) copies . remove ( host , Remotes :: PORT ) if modified . empty? log . info ( "Accepted #{id} in #{Age.new(start, limit: 1)} and not modified anything" ) else log . info ( "Accepted #{id} in #{Age.new(start, limit: 1)} and modified #{modified.join(', ')}" ) end modified << id if copies . all . count > 1 modified end
Returns a list of modifed wallets (as Zold::Id)
Returns a list of modifed wallets ( as Zold :: Id )