Class: LS4::CachedMDSService

Inherits:
Service show all
Defined in:
lib/ls4/service/mds_cache.rb

Instance Method Summary collapse

Methods inherited from Service

init

Methods included from EventBus::SingletonMixin

#ebus_bind!, #ebus_connect, extended

Methods included from EventBus::BusMixin

#ebus_all_slots, #ebus_disconnect!

Methods included from EventBus::DeclarerBase::Methods

#connect, #ebus_all_slots, #ebus_call_log, #ebus_call_slots, #ebus_signal_error, #ebus_signal_log, #ebus_signal_slots

Methods included from EventBus::DeclarerBase

#call_slot, #signal_slot

Instance Method Details

#add(key, attrs = {}, vname = nil, &cb) ⇒ Object



230
231
232
233
# File 'lib/ls4/service/mds_cache.rb', line 230

def add(key, attrs={}, vname=nil, &cb)
	invalidate_cache(key)
	MDSBus.add(key, attrs, vname, &cb)
end

#delete(key, version = nil, &cb) ⇒ Object



245
246
247
248
# File 'lib/ls4/service/mds_cache.rb', line 245

def delete(key, version=nil, &cb)
	invalidate_cache(key)
	MDSBus.delete(key, version, &cb)
end

#get_attrs(key, version = nil, &cb) ⇒ Object



222
223
224
# File 'lib/ls4/service/mds_cache.rb', line 222

def get_attrs(key, version=nil, &cb)
	MDSBus.get_attrs(key, version, &cb)
end

#get_okey(key, version = nil, &cb) ⇒ Object



209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/ls4/service/mds_cache.rb', line 209

def get_okey(key, version=nil, &cb)
	if version == nil
		if okey = get_cache(key)
			cb.call(okey, nil)
			return
		end
	end
	MDSBus.get_okey(key, version) {|okey,error|
		set_cache(key, okey) if okey
		cb.call(okey, error)
	}
end

#get_okey_attrs(key, version = nil, &cb) ⇒ Object



226
227
228
# File 'lib/ls4/service/mds_cache.rb', line 226

def get_okey_attrs(key, version=nil, &cb)
	MDSBus.get_okey_attrs(key, version, &cb)
end

#remove(key, &cb) ⇒ Object



240
241
242
243
# File 'lib/ls4/service/mds_cache.rb', line 240

def remove(key, &cb)
	invalidate_cache(key)
	MDSBus.remove(key, &cb)
end

#update_attrs(key, attrs, &cb) ⇒ Object



235
236
237
238
# File 'lib/ls4/service/mds_cache.rb', line 235

def update_attrs(key, attrs, &cb)
	invalidate_cache(key)
	MDSBus.update_attrs(key, attrs, &cb)
end

#util_locate(key, &cb) ⇒ Object



250
251
252
# File 'lib/ls4/service/mds_cache.rb', line 250

def util_locate(key, &cb)
	MDSBus.util_locate(key, &cb)
end