Sha256: fa2fab2b135a21b9293de7d620282056a2d1c0e8f24f5808a75c05f55a3b92c0

Contents?: true

Size: 1.05 KB

Versions: 16

Compression:

Stored size: 1.05 KB

Contents

module Concurrent
  module Actor
    class Envelope
      include TypeCheck

      # @!attribute [r] message
      #   @return [Object] a message
      # @!attribute [r] future
      #   @return [Edge::Future] a future which becomes resolved after message is processed
      # @!attribute [r] sender
      #   @return [Reference, Thread] an actor or thread sending the message
      # @!attribute [r] address
      #   @return [Reference] where this message will be delivered

      attr_reader :message, :future, :sender, :address

      def initialize(message, future, sender, address)
        @message = message
        @future  = Type! future, Edge::CompletableFuture, NilClass
        @sender  = Type! sender, Reference, Thread
        @address = Type! address, Reference
      end

      def sender_path
        if sender.is_a? Reference
          sender.path
        else
          sender.to_s
        end
      end

      def address_path
        address.path
      end

      def reject!(error)
        future.fail error unless future.nil?
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
concurrent-ruby-edge-0.2.4 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.2.3 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.2.3.pre3 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.2.2 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.2.1 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.2.0 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.2.0.pre5 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.1.2 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.2.0.pre4 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.2.0.pre3 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.2.0.pre2 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.2.0.pre1 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.1.1 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.1.0 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.1.0.pre3 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.1.0.pre2 lib/concurrent/actor/envelope.rb