Sha256: cb876be997905548976c7f0afd7456f901dd4f427135ec50a20fbca4dc4bbca4
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
module CephStorage # core representation of a file. # This is a mixin module for other storage object modules module StorageObject # Represent an object that can be written to or read from # This is designed to be modular so that you can expand into other # technologies attr_accessor :name def move(dst_object) log("move to '#{dst_object.class}/#{dst_object.name}'") dst_object.write_file(read_file) copy_xattrs(dst_object) destroy end def copy(dst_object) log("copy to '#{dst_object.class}/#{dst_object.name}'") dst_object.write_file(read_file) copy_xattrs(dst_object) end def copy_xattrs(dst_object) log('copy xattrs') return unless xattr_supported?(dst_object) xattr_enumerator.each do |source_xattr| dst_object.xattr(source_xattr.name) do |dst_xattr| dst_xattr.value = source_xattr.value end end end def xattr_supported?(dst_object) CephStorage::StorageObject.supports_xattr?(self) && CephStorage::StorageObject.supports_xattr?(dst_object) end class << self def supports_xattr?(obj) obj.respond_to? :xattr_enumerator end end def log(message) CephStorage.log("storage object #{name} #{message}") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ceph_storage-0.1.1 | lib/ceph_storage/storage_object.rb |
ceph_storage-0.1.0 | lib/ceph_storage/storage_object.rb |