Documentation ¶
Index ¶
- Constants
- func BytesToHigherMiBs(bytes uint64) uint64
- func GenerateRandomBytes(length int) []byte
- func GetResolvedPath(filePath string) (resolvedPath string, err error)
- func MiBsToBytes(mibs uint64) uint64
- func NestedSizeOfGcsMinObject(m *gcs.MinObject) (size int)
- func Stringify(input any) (string, error)
- func UnsafeSizeOf[T any](ptr *T) int
Constants ¶
const GCSFUSE_PARENT_PROCESS_DIR = "gcsfuse-parent-process-dir"
const HeapSizeToRssConversionFactor float64 = 2
HeapSizeToRssConversionFactor is a constant factor which we multiply to the calculated heap-size to get the corresponding resident set size.
const MaxMiBsInUint64 uint64 = math.MaxUint64 >> 20
const Random = "Random"
const Sequential = "Sequential"
Constants for read types - Sequential/Random
Variables ¶
This section is empty.
Functions ¶
func BytesToHigherMiBs ¶
BytesToHigherMiBs returns the MiBs equivalent to the given number of bytes. If bytes is not an exact number of MiBs, then it returns the next higher no. of MiBs. For reference, each MiB = 2^20 bytes.
func GenerateRandomBytes ¶
func GetResolvedPath ¶
1. Returns the same filepath in case of absolute path or empty filename. 2. For child process, it resolves relative path like, ./test.txt, test.txt ../test.txt etc, with respect to GCSFUSE_PARENT_PROCESS_DIR because we execute the child process from different directory and input files are provided with respect to GCSFUSE_PARENT_PROCESS_DIR. 3. For relative path starting with ~, it resolves with respect to home dir.
func MiBsToBytes ¶
MiBsToBytes returns the bytes equivalent of given number of MiBs. For reference, each MiB = 2^20 bytes. It supports only upto 2^44-1 MiBs (~4 Tebi MiBs, or ~4 Ebi bytes) as inputs, and panics for higher inputs.
func NestedSizeOfGcsMinObject ¶
NestedSizeOfGcsMinObject returns the full nested memory size of the gcs.MinObject pointed by the passed pointer. Improvement scope: This can be generalized to a general-struct but that needs better understanding of the reflect package and other related packages.
func Stringify ¶
Stringify marshals an object (only exported attribute) to a JSON string. If marshalling fails, it returns an empty string.
func UnsafeSizeOf ¶
UnsafeSizeOf returns the unsafe.Sizeof or raw-size of the object pointed to by the given pointer. It does not account for the pointer's size on memory itself. For e.g. if an int is 8 bytes and an empty string is 16 bytes, then UnsafeSizeOf(&struct{int, string}) return 24 (8+16).
Types ¶
This section is empty.