Grab value from cache when mapping
This commit is contained in:
parent
58568b06fa
commit
14895eded1
@ -31,8 +31,8 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def converter(proto, broker, cacher)
|
||||
cid = proto.addr.to_s if proto.addr.to_s != ""
|
||||
return cacher[cid] if cid && cacher.registered?(cid)
|
||||
cid = proto.target.to_s if proto.target.to_s != ""
|
||||
return cacher[cid].value if cid && cacher.registered?(cid)
|
||||
|
||||
project = Client::Basis.load(proto, broker: broker)
|
||||
cacher[cid] = project if cid
|
||||
|
||||
@ -15,7 +15,7 @@ module VagrantPlugins
|
||||
|
||||
def converter(project, ui, cacher)
|
||||
cid = project.resource_id
|
||||
return cacher[cid] if cacher.registered?(cid)
|
||||
return cacher[cid].value if cacher.registered?(cid)
|
||||
logger.warn("cache miss for environment with project resource id #{cid} cache=#{cacher} !!")
|
||||
env = Vagrant::Environment.new(ui: ui, client: project)
|
||||
cacher[cid] = env
|
||||
@ -37,7 +37,7 @@ module VagrantPlugins
|
||||
|
||||
def converter(project, cacher, mapper)
|
||||
cid = project.resource_id
|
||||
return cacher[cid] if cacher.registered?(cid)
|
||||
return cacher[cid].value if cacher.registered?(cid)
|
||||
logger.warn("cache miss for environment with project resource id #{cid} cache=#{cacher}")
|
||||
ui = mapper.map(project, to: Vagrant::UI::Remote)
|
||||
env = Vagrant::Environment.new(client: project, ui: ui)
|
||||
|
||||
@ -49,8 +49,8 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def converter(proto, broker, cacher)
|
||||
cid = proto.addr.to_s if proto.addr.to_s != ""
|
||||
return cacher[cid] if cid && cacher.registered?(cid)
|
||||
cid = proto.target.to_s if proto.target.to_s != ""
|
||||
return cacher[cid].value if cid && cacher.registered?(cid)
|
||||
|
||||
project = Client::Project.load(proto, broker: broker)
|
||||
cacher[cid] = project if cid
|
||||
|
||||
@ -41,8 +41,8 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def converter(proto, broker, cacher)
|
||||
cid = proto.addr.to_s if proto.addr.to_s != ""
|
||||
return cacher[cid] if cid && cacher.registered?(cid)
|
||||
cid = proto.target.to_s if proto.target.to_s != ""
|
||||
return cacher[cid].value if cid && cacher.registered?(cid)
|
||||
|
||||
project = Client::SyncedFolder.load(proto, broker: broker)
|
||||
cacher[cid] = project if cid
|
||||
|
||||
@ -7,7 +7,6 @@ module VagrantPlugins
|
||||
include Mutex_m
|
||||
|
||||
class Entry
|
||||
include Mutex_m
|
||||
attr_reader :value
|
||||
|
||||
def initialize(value)
|
||||
@ -16,7 +15,6 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def value
|
||||
raise "Entry must be locked to access value" if !mu_locked?
|
||||
@value
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user