Class: Isomorfeus::Speednode::Runtime::VM

Inherits:
Object
  • Object
show all
Defined in:
lib/isomorfeus/speednode/runtime.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ VM

Returns a new instance of VM.



23
24
25
26
27
28
29
# File 'lib/isomorfeus/speednode/runtime.rb', line 23

def initialize(options)
  @mutex = Mutex.new
  @socket_path = nil
  @options = options
  @started = false
  @socket = nil
end

Class Method Details

.finalize(socket) ⇒ Object



35
36
37
38
39
40
# File 'lib/isomorfeus/speednode/runtime.rb', line 35

def self.finalize(socket)
  proc {
    VMCommand.new(socket, "exit", [0]).execute
    socket.close
  }
end

Instance Method Details

#delete_context(context) ⇒ Object



50
51
52
# File 'lib/isomorfeus/speednode/runtime.rb', line 50

def delete_context(context)
  command("deleteContext", context)
end

#exec(context, source) ⇒ Object



42
43
44
# File 'lib/isomorfeus/speednode/runtime.rb', line 42

def exec(context, source)
  command("exec", {'context' => context, 'source' => source})
end

#execp(context, source) ⇒ Object



46
47
48
# File 'lib/isomorfeus/speednode/runtime.rb', line 46

def execp(context, source)
  command("execp", {'context' => context, 'source' => source})
end

#startObject



54
55
56
57
58
# File 'lib/isomorfeus/speednode/runtime.rb', line 54

def start
  @mutex.synchronize do
    start_without_synchronization
  end
end

#started?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/isomorfeus/speednode/runtime.rb', line 31

def started?
  @started
end