PHP Класс PHPDaemon\FS\FileSystem

Автор: Vasily Zorin ([email protected])
Наследование: use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog, use trait PHPDaemon\Traits\EventLoopContainer
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$badFDttl TTL for bad descriptors in seconds
$eioVer Required EIO version
$ev Main FS event
$fd EIO file descriptor
$fdCache File descriptor cache
$fdCacheSize Maximum number of open files in cache
$modeTypes Mode types
$supported Is EIO supported?

Открытые методы

Метод Описание
__construct ( )
checkFileReadable ( string $path ) : boolean Checks if file exists and readable
chown ( string $path, integer $uid, integer $gid, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean Changes ownership of file/directory
genRndTempnam ( string $dir = null, string $prefix = 'php' ) : string Returns random temporary file name
genRndTempnamPrefix ( string $dir, string $prefix ) : string Returns random temporary file name
init ( ) : void Initialize FS driver
initEvent ( ) : void Initialize main FS event
lstat ( string $path, callable $cb, integer $pri = EIO_PRI_DEFAULT ) : resource | true lstat()
mkdir ( string $path, integer $mode, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean Creates directory
open ( string $path, string $flags, callable $cb, integer $mode = null, integer $pri = EIO_PRI_DEFAULT ) : resource Open file
readdir ( string $path, callable $cb = null, integer $flags = null, integer $pri = EIO_PRI_DEFAULT ) : resource | true Readdir()
readfile ( string $path, callable $cb, integer $pri = EIO_PRI_DEFAULT ) : resource | true Reads whole file
readfileChunked ( string $path, callable $cb, callable $chunkcb, integer $pri = EIO_PRI_DEFAULT ) : resource Reads file chunk-by-chunk
realpath ( string $path, callable $cb, integer $pri = EIO_PRI_DEFAULT ) : resource | true realpath()
rename ( string $path, string $newpath, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean Rename
rmdir ( string $path, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean Removes empty directory
sanitizePath ( string $path ) : string Sanitize path
sendfile ( mixed $outfd, string $path, callable $cb, callable $startCb = null, integer $offset, integer $length = null, integer $pri = EIO_PRI_DEFAULT ) : true sendfile()
stat ( string $path, callable $cb, integer $pri = EIO_PRI_DEFAULT ) : resource | true Gets stat() information
statPrepare ( mixed $stat ) : array Prepare value of stat()
statvfs ( string $path, callable $cb, integer $pri = EIO_PRI_DEFAULT ) : resource | false statvfs()
sync ( callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | false sync()
syncfs ( callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | false statfs()
tempnam ( string $dir, string $prefix, callable $cb ) : resource Obtain exclusive temporary file
touch ( string $path, integer $mtime, integer $atime = null, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean touch()
truncate ( string $path, integer $offset, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean Truncate file
unlink ( string $path, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean Unlink file
updateConfig ( ) : void Called when config is updated
waitAllEvents ( ) : void Block until all FS events are completed

Защищенные методы

Метод Описание
tempnamHandler ( $dir, $prefix, $cb, &$tries ) Generates closure tempnam handler

Описание методов

__construct() публичный Метод

public __construct ( )

checkFileReadable() публичный статический Метод

Checks if file exists and readable
public static checkFileReadable ( string $path ) : boolean
$path string Path
Результат boolean Exists and readable?

chown() публичный статический Метод

Changes ownership of file/directory
public static chown ( string $path, integer $uid, integer $gid, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean
$path string Path
$uid integer User ID
$gid integer Group ID
$cb callable = null Callback
$pri integer = EIO_PRI_DEFAULT Priority
Результат resource | boolean

genRndTempnam() публичный статический Метод

Returns random temporary file name
public static genRndTempnam ( string $dir = null, string $prefix = 'php' ) : string
$dir string Directory
$prefix string Prefix
Результат string Path

genRndTempnamPrefix() публичный статический Метод

Returns random temporary file name
public static genRndTempnamPrefix ( string $dir, string $prefix ) : string
$dir string Directory
$prefix string Prefix
Результат string Path

init() публичный статический Метод

Initialize FS driver
public static init ( ) : void
Результат void

initEvent() публичный статический Метод

Initialize main FS event
public static initEvent ( ) : void
Результат void

lstat() публичный статический Метод

lstat()
public static lstat ( string $path, callable $cb, integer $pri = EIO_PRI_DEFAULT ) : resource | true
$path string Path
$cb callable Callback
$pri integer Priority
Результат resource | true

mkdir() публичный статический Метод

Creates directory
public static mkdir ( string $path, integer $mode, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean
$path string Path
$mode integer Mode (octal)
$cb callable Callback
$pri integer Priority
Результат resource | boolean

open() публичный статический Метод

Open file
public static open ( string $path, string $flags, callable $cb, integer $mode = null, integer $pri = EIO_PRI_DEFAULT ) : resource
$path string Path
$flags string Flags
$cb callable Callback (File)
$mode integer Mode (see EIO_S_I* constants)
$pri integer Priority
Результат resource

readdir() публичный статический Метод

Readdir()
public static readdir ( string $path, callable $cb = null, integer $flags = null, integer $pri = EIO_PRI_DEFAULT ) : resource | true
$path string Path
$cb callable = null Callback
$flags integer = null Flags
$pri integer = EIO_PRI_DEFAULT Priority
Результат resource | true

readfile() публичный статический Метод

Reads whole file
public static readfile ( string $path, callable $cb, integer $pri = EIO_PRI_DEFAULT ) : resource | true
$path string Path
$cb callable Callback (Path, Contents)
$pri integer Priority
Результат resource | true

readfileChunked() публичный статический Метод

Reads file chunk-by-chunk
public static readfileChunked ( string $path, callable $cb, callable $chunkcb, integer $pri = EIO_PRI_DEFAULT ) : resource
$path string Path
$cb callable Callback (Path, Success)
$chunkcb callable Chunk callback (Path, Chunk)
$pri integer Priority
Результат resource

realpath() публичный статический Метод

realpath()
public static realpath ( string $path, callable $cb, integer $pri = EIO_PRI_DEFAULT ) : resource | true
$path string Path
$cb callable Callback
$pri integer Priority
Результат resource | true

rename() публичный статический Метод

Rename
public static rename ( string $path, string $newpath, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean
$path string Path
$newpath string New path
$cb callable Callback
$pri integer Priority
Результат resource | boolean

rmdir() публичный статический Метод

Removes empty directory
public static rmdir ( string $path, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean
$path string Path
$cb callable Callback
$pri integer Priority
Результат resource | boolean

sanitizePath() публичный статический Метод

Sanitize path
public static sanitizePath ( string $path ) : string
$path string Path
Результат string Sanitized path

sendfile() публичный статический Метод

sendfile()
public static sendfile ( mixed $outfd, string $path, callable $cb, callable $startCb = null, integer $offset, integer $length = null, integer $pri = EIO_PRI_DEFAULT ) : true
$outfd mixed File descriptor
$path string Path
$cb callable Callback
$startCb callable Start callback
$offset integer Offset
$length integer Length
$pri integer Priority
Результат true Success

stat() публичный статический Метод

Gets stat() information
public static stat ( string $path, callable $cb, integer $pri = EIO_PRI_DEFAULT ) : resource | true
$path string Path
$cb callable Callback
$pri integer Priority
Результат resource | true

statPrepare() публичный статический Метод

Prepare value of stat()
public static statPrepare ( mixed $stat ) : array
$stat mixed Data
Результат array hash

statvfs() публичный статический Метод

statvfs()
public static statvfs ( string $path, callable $cb, integer $pri = EIO_PRI_DEFAULT ) : resource | false
$path string Path
$cb callable Callback
$pri integer Priority
Результат resource | false

sync() публичный статический Метод

sync()
public static sync ( callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | false
$cb callable Callback
$pri integer Priority
Результат resource | false

syncfs() публичный статический Метод

statfs()
public static syncfs ( callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | false
$cb callable Callback
$pri integer Priority
Результат resource | false

tempnam() публичный статический Метод

Obtain exclusive temporary file
public static tempnam ( string $dir, string $prefix, callable $cb ) : resource
$dir string Directory
$prefix string Prefix
$cb callable Callback (File)
Результат resource

tempnamHandler() защищенный статический Метод

Generates closure tempnam handler
protected static tempnamHandler ( $dir, $prefix, $cb, &$tries )
$dir
$prefix
$cb
$tries

touch() публичный статический Метод

touch()
public static touch ( string $path, integer $mtime, integer $atime = null, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean
$path string Path
$mtime integer Last modification time
$atime integer Last access time
$cb callable Callback
$pri integer Priority
Результат resource | boolean

truncate() публичный статический Метод

Truncate file
public static truncate ( string $path, integer $offset, callable $cb = null, integer $pri = EIO_PRI_DEFAULT ) : resource | boolean
$path string Path
$offset integer Offset
$cb callable Callback
$pri integer Priority
Результат resource | boolean

updateConfig() публичный статический Метод

Called when config is updated
public static updateConfig ( ) : void
Результат void

waitAllEvents() публичный статический Метод

Block until all FS events are completed
public static waitAllEvents ( ) : void
Результат void

Описание свойств

$badFDttl публичное статическое свойство

TTL for bad descriptors in seconds
public static $badFDttl

$eioVer публичное статическое свойство

Required EIO version
public static $eioVer

$ev публичное статическое свойство

Main FS event
public static $ev

$fd публичное статическое свойство

EIO file descriptor
public static $fd

$fdCache публичное статическое свойство

File descriptor cache
public static $fdCache

$fdCacheSize публичное статическое свойство

Maximum number of open files in cache
public static $fdCacheSize

$modeTypes публичное статическое свойство

Mode types
public static $modeTypes

$supported публичное статическое свойство

Is EIO supported?
public static $supported