map.rb: Added documentation.
This commit is contained in:
parent
b267f30022
commit
f1c275ea33
1 changed files with 25 additions and 2 deletions
27
qasim/map.rb
27
qasim/map.rb
|
@ -22,6 +22,10 @@ module Qasim
|
||||||
CYPHER_AES256CBC = "aes-256-cbc".to_sym
|
CYPHER_AES256CBC = "aes-256-cbc".to_sym
|
||||||
CYPHERS = [ CYPHER_ARCFOUR, CYPHER_AES256CBC ]
|
CYPHERS = [ CYPHER_ARCFOUR, CYPHER_AES256CBC ]
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set defaults properties for maps
|
||||||
|
#
|
||||||
def initialize config, map_path
|
def initialize config, map_path
|
||||||
@config = config
|
@config = config
|
||||||
@path = map_path
|
@path = map_path
|
||||||
|
@ -37,6 +41,10 @@ module Qasim
|
||||||
self.load @path
|
self.load @path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Load map description from file
|
||||||
|
#
|
||||||
def load path=nil
|
def load path=nil
|
||||||
@path=path unless path.nil?
|
@path=path unless path.nil?
|
||||||
#rdebug "Parsing map #{@path}"
|
#rdebug "Parsing map #{@path}"
|
||||||
|
@ -88,6 +96,10 @@ module Qasim
|
||||||
f.close
|
f.close
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Write map description to file
|
||||||
|
#
|
||||||
def write path=nil
|
def write path=nil
|
||||||
@path=path unless path.nil?
|
@path=path unless path.nil?
|
||||||
|
|
||||||
|
@ -99,13 +111,19 @@ module Qasim
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test map liveness (how ?)
|
||||||
|
# FIXME: not implemented
|
||||||
|
#
|
||||||
def online?
|
def online?
|
||||||
#rdebug "testing online? %s " % self.inspect
|
#rdebug "testing online? %s " % self.inspect
|
||||||
#FIXME: test liveness
|
#FIXME: test liveness
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# test if map is connected / mounted
|
# Test if map is connected / mounted
|
||||||
#
|
#
|
||||||
def connected?
|
def connected?
|
||||||
f = File.open("/proc/mounts")
|
f = File.open("/proc/mounts")
|
||||||
|
@ -131,8 +149,9 @@ module Qasim
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# connect given map
|
# Connect map
|
||||||
#
|
#
|
||||||
def connect &block
|
def connect &block
|
||||||
puts "[#{File.basename @path}] Connecting..."
|
puts "[#{File.basename @path}] Connecting..."
|
||||||
|
@ -173,6 +192,10 @@ module Qasim
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Disconnect map
|
||||||
|
#
|
||||||
def disconnect &block
|
def disconnect &block
|
||||||
puts "Disconnecting map #{@path}"
|
puts "Disconnecting map #{@path}"
|
||||||
@links.each do |name, remotepath|
|
@links.each do |name, remotepath|
|
||||||
|
|
Loading…
Reference in a new issue