class Moab::FileManifestation
A container for a file signature and all the physical file instances that have that signature This element has one child {FileSignature} element, and one or more {FileInstance} elements Regarding the class name, see
Data Model¶ ↑
-
{FileInventory} = container for recording information about a collection of related files
-
{FileGroup} [1..*] = subset allow segregation of content and metadata files.
-
{FileManifestation} [1..*] = snapshot of a file’s filesystem characteristics
-
{FileSignature} [1] = file fixity information
-
{FileInstance} [1..*] = filepath and timestamp of any physical file having that signature
-
-
-
@note Copyright © 2012 by The Board of Trustees of the Leland Stanford
Junior University.
All rights reserved. See {file:LICENSE.rdoc} for details.
Public Class Methods
Source
# File lib/moab/file_manifestation.rb, line 26 def initialize(opts = {}) @instances = [] super(opts) end
(see Serializable#initialize)
Serializer::Serializable::new
Public Instance Methods
Source
# File lib/moab/file_manifestation.rb, line 78 def ==(other) return false unless other.respond_to?(:signature) && other.respond_to?(:instances) # Cannot equal an incomparable type! (signature == other.signature) && (instances == other.instances) end
@api internal @param other [FileManifestation] The {FileManifestation} object to compare with self @return [Boolean] True if {FileManifestation} objects have same content
Source
# File lib/moab/file_manifestation.rb, line 69 def block_count block_size = 1024 instance_blocks = (signature.size.to_i + block_size - 1) / block_size file_count * instance_blocks end
@api internal @return [Integer] The total disk usage (in 1 kB blocks) of all files that share this manifestation’s signature
(estimating du -k result)
Source
# File lib/moab/file_manifestation.rb, line 62 def byte_count file_count.to_i * signature.size.to_i end
@api internal @return [Integer] The total size (in bytes) of all files that share this manifestation’s signature
Source
# File lib/moab/file_manifestation.rb, line 56 def file_count instances.size end
@api internal @return [Integer] The total number of {FileInstance} objects in this manifestation.
(Number of files that share this manifestation's signature)
Source
# File lib/moab/file_manifestation.rb, line 49 def paths instances.collect(&:path) end
@api internal @return [Array<String>] Create an array from all the file paths of the child {FileInstance} objects
Source
# File lib/moab/file_manifestation.rb, line 35 def signature @signature.is_a?(Array) ? @signature[0] : @signature end
Source
# File lib/moab/file_manifestation.rb, line 39 def signature=(signature) @signature = signature.is_a?(Array) ? signature[0] : signature end