class Dizby::SemiObjectProxy

Public Class Methods

new(uri, ref) click to toggle source
# File lib/dizby/distributed/semi_proxy.rb, line 13
def initialize(uri, ref)
  @uri = uri
  @ref = ref
end

Public Instance Methods

evaluate(server) click to toggle source
# File lib/dizby/distributed/semi_proxy.rb, line 18
def evaluate(server)
  # cut down on network times by using the object if it exists locally
  success, obj = Dizby.get_obj(@uri, @ref)

  if success
    server.log.debug("found local obj: #{obj.inspect}")
    obj
  else
    server.log.debug("creating proxy to #{@ref} on #{@uri}")
    client, _ref = server.connect_to(ClientArguments.new(@uri, {}))
    ObjectProxy.new(client, @ref)
  end
end