UniEvent

 view release on metacpan or  search on metacpan

xs/Fs.xs  view on Meta::CPAN

void isdir (string_view path, Fs::bool_fn cb = nullptr, DLoopSP l = {}) {
    FSXS_FUNC_BOOL(Fs::isdir(path, cb, l), Fs::isdir(path));
}

void access (string_view path, int mode = 0, Fs::fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::access(path, mode, cb, l), Fs::access(path, mode));
}

void unlink (string_view path, Fs::fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::unlink(path, cb, l), Fs::unlink(path));
}

void sync (Sv _fd, Fs::fn cb = nullptr, DLoopSP l = {}) {
    auto fd = sv2fd(_fd);
    FSXS_EXPECTED(Fs::sync(fd, cb, l), Fs::sync(fd));
}

void datasync (Sv _fd, Fs::fn cb = nullptr, DLoopSP l = {}) {
    auto fd = sv2fd(_fd);
    FSXS_EXPECTED(Fs::datasync(fd, cb, l), Fs::datasync(fd));
}

void truncate (Sv path_or_fd, int64_t length = 0, Fs::fn cb = nullptr, DLoopSP l = {}) {
    if (path_or_fd.is_string()) {
        auto path = xs::in<string_view>(path_or_fd);
        FSXS_EXPECTED(Fs::truncate(path, length, cb, l), Fs::truncate(path, length));
    } else {
        auto fd = sv2fd(path_or_fd);
        FSXS_EXPECTED(Fs::truncate(fd, length, cb, l), Fs::truncate(fd, length));
    }
}

void chmod (Sv path_or_fd, int mode, Fs::fn cb = nullptr, DLoopSP l = {}) {
    if (path_or_fd.is_string()) {
        auto path = xs::in<string_view>(path_or_fd);
        FSXS_EXPECTED(Fs::chmod(path, mode, cb, l), Fs::chmod(path, mode));
    } else {
        auto fd = sv2fd(path_or_fd);
        FSXS_EXPECTED(Fs::chmod(fd, mode, cb, l), Fs::chmod(fd, mode));
    }
}

void touch (string_view path, int mode = Fs::DEFAULT_FILE_MODE, Fs::fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::touch(path, mode, cb, l), Fs::touch(path, mode));
}

void utime (Sv path_or_fd, double atime, double mtime, Fs::fn cb = nullptr, DLoopSP l = {}) {
    if (path_or_fd.is_string()) {
        auto path = xs::in<string_view>(path_or_fd);
        FSXS_EXPECTED(Fs::utime(path, atime, mtime, cb, l), Fs::utime(path, atime, mtime));
    } else {
        auto fd = sv2fd(path_or_fd);
        FSXS_EXPECTED(Fs::utime(fd, atime, mtime, cb, l), Fs::utime(fd, atime, mtime));
    }
}

void lutime (string_view path, double atime, double mtime, Fs::fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::lutime(path, atime, mtime, cb, l), Fs::lutime(path, atime, mtime));
}

void chown (Sv path_or_fd, uid_t uid, gid_t gid, Fs::fn cb = nullptr, DLoopSP l = {}) {
    if (path_or_fd.is_string()) {
        auto path = xs::in<string_view>(path_or_fd);
        FSXS_EXPECTED(Fs::chown(path, uid, gid, cb, l), Fs::chown(path, uid, gid));
    } else {
        auto fd = sv2fd(path_or_fd);
        FSXS_EXPECTED(Fs::chown(fd, uid, gid, cb, l), Fs::chown(fd, uid, gid));
    }
}

void lchown (string_view path, uid_t uid, gid_t gid, Fs::fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::lchown(path, uid, gid, cb, l), Fs::lchown(path, uid, gid));
}

void rename (string_view src, string_view dst, Fs::fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::rename(src, dst, cb, l), Fs::rename(src, dst));
}

void sendfile (Sv _out, Sv _in, int64_t offset, size_t length, Fs::sendfile_fn cb = nullptr, DLoopSP l = {}) {
    auto out = sv2fd(_out);
    auto in  = sv2fd(_in);
    FSXS_EXPECTED(Fs::sendfile(out, in, offset, length, cb, l), Fs::sendfile(out, in, offset, length));
}

void link (string_view src, string_view dst, Fs::fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::link(src, dst, cb, l), Fs::link(src, dst));
}

void symlink (string_view src, string_view dst, int flags = 0, Fs::fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::symlink(src, dst, flags, cb, l), Fs::symlink(src, dst, flags));
}

void readlink (string_view path, Fs::string_fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::readlink(path, cb, l), Fs::readlink(path));
}

void realpath (string_view path, Fs::string_fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::realpath(path, cb, l), Fs::realpath(path));
}

void copyfile (string_view src, string_view dst, int flags, Fs::fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::copyfile(src, dst, flags, cb, l), Fs::copyfile(src, dst, flags));
}

void mkdtemp (string_view path, Fs::string_fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::mkdtemp(path, cb, l), Fs::mkdtemp(path));
}

void mkstemp (string_view path, Fs::path_fd_fn cb = nullptr, DLoopSP l = {}) {
    FSXS_EXPECTED(Fs::mkstemp(path, cb, l), Fs::mkstemp(path));
}

void read (Sv _fd, size_t size, int64_t offset = -1, Fs::string_fn cb = nullptr, DLoopSP l = {}) {
    auto fd = sv2fd(_fd);
    FSXS_EXPECTED(Fs::read(fd, size, offset, cb, l), Fs::read(fd, size, offset));
}

void write (Sv _fd, Sv _buf, int64_t offset = -1, Fs::fn cb = nullptr, DLoopSP l = {}) {
    auto fd = sv2fd(_fd);
    auto buf = sv2buf(_buf);
    FSXS_EXPECTED(Fs::write(fd, buf, offset, cb, l), Fs::write(fd, buf, offset));
}


MODULE = UniEvent::Fs                PACKAGE = UniEvent::Request::Fs
PROTOTYPES: DISABLE

BOOT {
    Stash s(__PACKAGE__);
    s.inherit("UniEvent::Work");
}

xs/Fs.xs  view on Meta::CPAN


void Fs::Request::mkdir      (string_view path, int mode, Fs::fn cb)

void Fs::Request::rmdir      (string_view path, Fs::fn cb)

void Fs::Request::remove     (string_view path, Fs::fn cb)

void Fs::Request::mkpath     (string_view path, int mode, Fs::fn cb)

void Fs::Request::scandir    (string_view path, Fs::scandir_fn cb)

void Fs::Request::remove_all (string_view path, Fs::fn cb)


void Fs::Request::open     (string_view path, int flags, int mode, Fs::open_fn cb)

void Fs::Request::close    (Fs::fn cb)

void Fs::Request::stat     (Sv arg1, Sv arg2 = Sv()) {
    if (arg2) THIS->stat(xs::in<string_view>(arg1), xs::in<Fs::stat_fn>(arg2));
    else      THIS->stat(xs::in<Fs::stat_fn>(arg1));
}

void Fs::Request::lstat    (string_view path, Fs::stat_fn cb)

void Fs::Request::statfs   (string_view path, Fs::statfs_fn cb)

void Fs::Request::exists   (string_view path, Fs::bool_fn cb)

void Fs::Request::isfile   (string_view path, Fs::bool_fn cb)

void Fs::Request::isdir    (string_view path, Fs::bool_fn cb)

void Fs::Request::access   (string_view path, int mode, Fs::fn cb)

void Fs::Request::unlink   (string_view path, Fs::fn cb)

void Fs::Request::sync     (Fs::fn cb)

void Fs::Request::datasync (Fs::fn cb)

void Fs::Request::truncate (Sv arg1, Sv arg2, Sv arg3 = Sv()) {
    if (arg3) THIS->truncate(xs::in<string_view>(arg1), xs::in<int64_t>(arg2), xs::in<Fs::fn>(arg3));
    else      THIS->truncate(xs::in<int64_t>(arg1), xs::in<Fs::fn>(arg2));
}

void Fs::Request::chmod (Sv arg1, Sv arg2, Sv arg3 = Sv()) {
    if (arg3) THIS->chmod(xs::in<string_view>(arg1), xs::in<int>(arg2), xs::in<Fs::fn>(arg3));
    else      THIS->chmod(xs::in<int>(arg1), xs::in<Fs::fn>(arg2));
}

void Fs::Request::touch (string_view path, int mode, Fs::fn cb)

void Fs::Request::utime (Sv arg1, Sv arg2, Sv arg3, Sv arg4 = Sv()) {
    if (arg4) THIS->utime(xs::in<string_view>(arg1), xs::in<double>(arg2), xs::in<double>(arg3), xs::in<Fs::fn>(arg4));
    else      THIS->utime(xs::in<double>(arg1), xs::in<double>(arg2), xs::in<Fs::fn>(arg3));
}

void Fs::Request::lutime (string_view path, double atime, double mtime, Fs::fn cb)

void Fs::Request::chown (Sv arg1, Sv arg2, Sv arg3, Sv arg4 = Sv()) {
    if (arg4) THIS->chown(xs::in<string_view>(arg1), xs::in<uid_t>(arg2), xs::in<gid_t>(arg3), xs::in<Fs::fn>(arg4));
    else      THIS->chown(xs::in<uid_t>(arg1), xs::in<gid_t>(arg2), xs::in<Fs::fn>(arg3));
}

void Fs::Request::lchown   (string_view path, uid_t uid, gid_t gid, Fs::fn cb)

void Fs::Request::rename   (string_view src, string_view dst, Fs::fn cb)

void Fs::Request::sendfile (Sv out, Sv in, int64_t offset, size_t length, Fs::sendfile_fn cb) {
    THIS->sendfile(sv2fd(out), sv2fd(in), offset, length, cb);
}

void Fs::Request::link     (string_view src, string_view dst, Fs::fn cb)

void Fs::Request::symlink  (string_view src, string_view dst, int flags, Fs::fn cb)

void Fs::Request::readlink (string_view path, Fs::string_fn cb)

void Fs::Request::realpath (string_view path, Fs::string_fn cb)

void Fs::Request::copyfile (string_view src, string_view dst, int flags, Fs::fn cb)

void Fs::Request::mkdtemp  (string_view path, Fs::string_fn cb)

void Fs::Request::read     (size_t size, int64_t offset, Fs::string_fn cb)

void Fs::Request::write    (Sv buf, int64_t offset, Fs::fn cb) {
    THIS->write(sv2buf(buf), offset, cb);
}



( run in 1.301 second using v1.01-cache-2.11-cpan-ff9377addf4 )