Class: Qfs::Attr

Inherits:
Object
  • Object
show all
Defined in:
lib/qfs.rb,
ext/qfs/attr.c

Overview

A container class for the properties of a file or directory. These can be retrieved with either Client::stat or File#stat.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#chunksInt (readonly)

The number of chunks in the file or files in a directory

Returns:

  • (Int)

    the current value of chunks



363
364
365
# File 'lib/qfs.rb', line 363

def chunks
  @chunks
end

#ctimeTime (readonly)

The time the file/directory’s attributes were changed

Returns:

  • (Time)

    the current value of ctime



363
364
365
# File 'lib/qfs.rb', line 363

def ctime
  @ctime
end

#directoriesInt (readonly)

The number of subdirectories

Returns:

  • (Int)

    the current value of directories



363
364
365
# File 'lib/qfs.rb', line 363

def directories
  @directories
end

#directoryBool (readonly)

If the file is a directory

Returns:

  • (Bool)

    the current value of directory



363
364
365
# File 'lib/qfs.rb', line 363

def directory
  @directory
end

#filenameString (readonly)

The base name of the file/directory

Returns:

  • (String)

    the current value of filename



363
364
365
# File 'lib/qfs.rb', line 363

def filename
  @filename
end

#gidInt (readonly)

Group ID

Returns:

  • (Int)

    the current value of gid



363
364
365
# File 'lib/qfs.rb', line 363

def gid
  @gid
end

#idInt (readonly)

Returns the current value of id.

Returns:

  • (Int)

    the current value of id



363
364
365
# File 'lib/qfs.rb', line 363

def id
  @id
end

#max_stierInt (readonly)

Returns the current value of max_stier.

Returns:

  • (Int)

    the current value of max_stier



363
364
365
# File 'lib/qfs.rb', line 363

def max_stier
  @max_stier
end

#min_stierInt (readonly)

Returns the current value of min_stier.

Returns:

  • (Int)

    the current value of min_stier



363
364
365
# File 'lib/qfs.rb', line 363

def min_stier
  @min_stier
end

#modeInt (readonly)

The permissions set on the file/directory

Returns:

  • (Int)

    the current value of mode



363
364
365
# File 'lib/qfs.rb', line 363

def mode
  @mode
end

#mtimeTime (readonly)

The time last modified

Returns:

  • (Time)

    the current value of mtime



363
364
365
# File 'lib/qfs.rb', line 363

def mtime
  @mtime
end

#recovery_stripesInt (readonly)

Returns the current value of recovery_stripes.

Returns:

  • (Int)

    the current value of recovery_stripes



363
364
365
# File 'lib/qfs.rb', line 363

def recovery_stripes
  @recovery_stripes
end

#replicasInt (readonly)

Returns the current value of replicas.

Returns:

  • (Int)

    the current value of replicas



363
364
365
# File 'lib/qfs.rb', line 363

def replicas
  @replicas
end

#sizeInt (readonly)

The size of the file

Returns:

  • (Int)

    the current value of size



363
364
365
# File 'lib/qfs.rb', line 363

def size
  @size
end

#stripe_sizeInt (readonly)

Returns the current value of stripe_size.

Returns:

  • (Int)

    the current value of stripe_size



363
364
365
# File 'lib/qfs.rb', line 363

def stripe_size
  @stripe_size
end

#striper_typeInt (readonly)

Returns the current value of striper_type.

Returns:

  • (Int)

    the current value of striper_type



363
364
365
# File 'lib/qfs.rb', line 363

def striper_type
  @striper_type
end

#stripesInt (readonly)

Returns the current value of stripes.

Returns:

  • (Int)

    the current value of stripes



363
364
365
# File 'lib/qfs.rb', line 363

def stripes
  @stripes
end

#uidInt (readonly)

User ID

Returns:

  • (Int)

    the current value of uid



363
364
365
# File 'lib/qfs.rb', line 363

def uid
  @uid
end

Instance Method Details

#directory?Boolean

Returns:

  • (Boolean)

#strip_sizeObject

#to_sObject

Attempt to mimic the format of the QFS “ls” command



365
366
367
368
369
370
371
372
373
374
375
# File 'lib/qfs.rb', line 365

def to_s
  [
    "#{directory? ? 'd' : '-'}#{mode_to_s}",
    '-',
    uid,
    gid,
    size,
    mtime.strftime('%Y-%m-%d %H:%M'),
    filename,
  ].join(' ')
end