BarecatFileInfo#

class barecat.BarecatFileInfo(path=None, mode=None, uid=None, gid=None, mtime_ns=None, shard=None, offset=None, size=None, crc32c=None)[source]#

Bases: BarecatEntryInfo

Describes file information such as path, location in the shards and metadata.

This class is used both when retrieving existing file information and when adding new files.

Parameters:
  • path (Optional[str]) – path to the file inside the archive

  • mode (Optional[int]) – file mode, i.e., permissions

  • uid (Optional[int]) – user ID

  • gid (Optional[int]) – group ID

  • mtime_ns (Optional[Union[int, datetime]]) – last modification time in nanoseconds since the Unix epoch

  • shard (Optional[int]) – shard number

  • offset (Optional[int]) – offset within the shard in bytes

  • size (Optional[int]) – size of the file in bytes

  • crc32c (Optional[int]) – CRC32C checksum of the file contents

Attributes#

shard

Shard number where the file is located.

offset

Offset within the shard in bytes.

size

Size of the file in bytes.

crc32c

CRC32C checksum of the file contents.

Properties#

end

End position of the file in the shard.

Instance Methods#

asdict()

Returns a dictionary representation of the file information.

fill_from_statresult(s)

Fills the file metadata information from a stat result, obtained from the file system.

isfile()

True if this is a file entry.