UTILS(3)

✨ UTILS(3) ✨ β€” nfstest.utils, from the utils 1.0 manual (section 3, bestie πŸ’…)

okay so welcome to the utilities module 🫢 this is where the shared stuff lives β€” the common classes and constants that everything else in the fam borrows. lowkey iconic. πŸ’–


🌸 NAME 🌸

nfstest.utils β€” the Utilities module, aka the communal closet everybody raids πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

It's the definition spot for the common classes and constants. That's the whole vibe. No cap. ✨


πŸ‘‘ CLASSES πŸ‘‘

πŸ’œ class SparseFile(baseobj.BaseObj)

The SparseFile object πŸ’…

SparseFile() -> New sparse file object πŸ¦‹

🌈 Usage:

# Create definition for a sparse file of size 10000 having
# two holes of size 1000 at offsets 3000 and 6000
x = SparseFile("/mnt/t/file1", 10000, [3000, 6000], 1000)

# Object attributes defined after creation using the above
# sample data:

# endhole: set to True if the file ends with a hole
# Above example ends with data so,
# x.endhole = False

# data_offsets: list of data segment offsets
# x.data_offsets = [0, 4000, 7000]

# hole_offsets: list of hole segment offsets including the
#   implicit hole at the end of the file
# x.hole_offsets = [3000, 6000, 10000]

# sparse_data: list of data/hole segments, each item in the list
#   has the following format [offset, size, type]
# x.sparse_data = [[0, 3000, 1], [3000, 1000, 0], [4000, 2000, 1],
#                  [6000, 1000, 0], [7000, 3000, 1]]

πŸŽ€ Methods defined here:

<div align="left">---------------------</div>

nah jk, here they are fr fr πŸ‘‡

⭐ __init__(self, absfile, file_size, hole_list, hole_size)

This makes the sparse file object definition β€” and listen, the file is NOT created, only the object, okay bestie? 😭 It just sets up the object attributes so that making the actual file later is, like, effortless. Slay.

  • absfile β€” the absolute path name of the file 🫢
  • file_size β€” the total size of the sparse file ✨
  • hole_list β€” the list of hole offsets πŸ•³οΈ
  • hole_size β€” the size for each hole 🌼

πŸ”₯ FUNCTIONS πŸ”₯

πŸ’« split_path(path)

Returns a list of components in path. That's it, that's the function, and it ate. πŸ‘‘


🌈 SEE ALSO 🌈

baseobj(3) β€” go say hi to the parent, iykyk 🧚


πŸ’€ BUGS πŸ’€

No known bugs. not a single one, we're literally flawless rn βœ¨πŸ™ˆ


🫢 AUTHOR 🫢

Jorge Mora (mora@netapp.com) β€” the main character who wrote all this πŸ’–πŸ‘‘


and that's the whole page bestie!! πŸŽ€ this was NFStest 3.2, dated 21 March 2023, and yes the utils 1.0 manual really did just get the group-chat treatment. periodt. πŸ’…πŸŒΈπŸ¦‹