GlusterFS::GFAPI::FFI::File - GFAPI File API
Return the internal file descriptor (glfd) that is used by the underlying implementation to request I/O operations.
The I/O mode for the file. If the file was created using the Volume-fopen()> function, this will be the value of the mode parameter. This is a read-only attribute.
Volume-
If the file object was created using Volume-fopen()>, the name of the file.
Bool indicating the current state of the file object. This is a read-only attribute; the close() method changes the value.
close()
Close the file. A closed file cannot be read or written any more.
This is similar to UNMAP command that is used to return the unused/freed blocks back to the storage system. In this implementation, fallocate with FALLOC_FL_PUNCH_HOLE is used to eventually release the blocks to the filesystem. If the brick has been mounted with '-o discard' option, then the discard request will eventually reach the SCSI storage if the storage device supports UNMAP.
UNMAP
FALLOC_FL_PUNCH_HOLE
-o discard
Return a duplicate of File object. This duplicate File class instance encapsulates a duplicate glfd obtained by invoking glfs_dup().
glfs_dup()
This is a Linux-specific sys call, unlike posix_fallocate()
Allows the caller to directly manipulate the allocated disk space for the file for the byte range starting at offset and continuing for length bytes.
Change this file's mode
Change this file's owner and group id
Flush buffer cache pages pertaining to data, but not the ones pertaining to metadata.
Return the size of a file, as reported by fstat()
fstat()
Retrieve the value of the extended attribute identified by key for the file.
key
Key of extended attribute
size
If size is specified as zero, we first determine the size of xattr and then allocate a buffer accordingly. If size is non-zero, it is assumed the caller knows the size of xattr.
Value of extended attribute corresponding to key specified.
Retrieve list of extended attributes for the file.
If size is specified as zero, we first determine the size of list and then allocate a buffer accordingly. If size is non-zero, it is assumed the caller knows the size of the list.
List of extended attributes.
Set extended attribute of file.
The key of extended attribute.
The valiue of extended attribute.
Possible values are 0 (default), 1 and 2.
If 0 - xattr will be created if it does not exist, or the value will be replaced if the xattr exists. If 1 - it performs a pure create, which fails if the named attribute already exists. If 2 - it performs a pure replace operation, which fails if the named attribute does not already exist.
Remove a extended attribute of the file.
Returns Stat object for this file.
Returns the stat information of the file.
Flush buffer cache pages pertaining to data and metadata.
Truncated the file to a size of length bytes.
If the file previously was larger than this size, the extra data is lost.
If the file previously was shorter, it is extended, and the extended part reads as null bytes.
length
Length to truncate the file to in bytes.
Set the read/write offset position of this file.
The new position is defined by pos relative to how
pos
how
sets new offset position according to 'how'
SEEK_SET - sets offset position pos bytes relative to beginning of file. SEEK_CUR - the position is set relative to the current position. SEEK_END - sets the position relative to the end of the file.
SEEK_SET
SEEK_CUR
SEEK_END
the new offset position
Read at most size bytes from the file.
length of read buffer. If less than 0, then whole file is read. Default is -1.
buffer of size length
Read up to len(buf) bytes into buf which must be a bytearray. This method is useful when you have to read a large file over multiple read calls. While read() allocates a buffer every time it's invoked, readinto() copies data to an already allocated buffer passed to it.
len(buf)
buf
read()
readinto()
the number of bytes read (0 for EOF).
Write data to the file.
data
The data to be written to file.
The size in bytes actually written
Fill length number of bytes with zeroes starting from offset.
offset
Start at offset location
Size/length in bytes
Ji-Hyeon Gim <potatogim@gluesys.com>
This software is copyright 2017-2018 by Ji-Hyeon Gim.
This is free software; you can redistribute it and/or modify it under the same terms as the GPLv2/LGPLv3.
To install GlusterFS::GFAPI::FFI::Stat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GlusterFS::GFAPI::FFI::Stat
CPAN shell
perl -MCPAN -e shell install GlusterFS::GFAPI::FFI::Stat
For more information on module installation, please visit the detailed CPAN module installation guide.