efl/src/lib/eio/efl_io_manager.eo

151 lines
3.1 KiB
Plaintext

import eina_types;
struct Eio.Data
{
[[A structure to handle arbitrary data to be sent over Promises.]]
data: void_ptr;
size: uint;
}
// FIXME: all events should be Eo objects not data if we want to modify them
struct Eio.Filter.Direct.Data
{
info: const(Eina.File.Direct.Info)*;
filter: bool;
}
struct Eio.Filter.Name.Data
{
file: string;
filter: bool;
}
struct Eio.Xattr.Data
{
data: string;
size: uint;
}
// FIXME: We should send list of stuff in progress not single item, callback cost is to high
class Efl.Io.Manager (Efl.Object)
{
[[Class representing an asynchronous file operation.]]
methods {
file_ls {
[[Lists entries in a given path.]]
params {
@in path: string;
}
return: promise<int, string>;
}
file_direct_ls {
[[Lists entries in a given path with more information.]]
params {
@in path: string;
}
return: promise<int, const(Eina_File_Direct_Info)*>;
}
file_stat_ls {
[[Lists entries in a given path with stat information.]]
params {
@in path: string;
}
return: promise<int, const(Eina_File_Direct_Info)*>;
}
dir_stat_ls {
[[Recursively list the directory content and its sub content.]]
params {
@in path: string;
}
return: promise<int, const(Eina_File_Direct_Info)*>;
}
dir_direct_ls {
[[Recursively list the directory content and its sub content.]]
params {
@in path: string;
}
return: promise<int, const(Eina_File_Direct_Info)*>;
}
file_direct_stat {
[[Get stat info on a given file/directory.]]
params {
@in path: string;
}
return: promise<Eina_Stat>;
}
// Extended attributes
@property file_xattr_list {
[[Lists all extended attributes asynchronously.]]
keys {
path: string;
}
get {
return: promise<int, string>;
}
}
@property file_xattr {
[[Retrieves or sets information of a given extended attribute.]]
set {
values {
attribute: string;
xattr_data: string;
xattr_size: uint;
flags: Eina.Xattr.Flags;
}
return: promise<int>;
}
get {
keys {
path: string;
attribute: string;
}
return: promise<Eio.Xattr.Data>;
}
keys {
path: string;
}
}
// helper api
file_open {
[[Opens a file.
The fulfilled value in the promise will be the Eina.File*.]]
params {
@in path: string;
@in shared: bool;
}
return: promise<Eina.File*>;
}
file_close {
[[Closes an open Eina.File.]]
params {
@in file: Eina.File*;
// Here we're just interested whether the promise was fullfilled or not. No value needed.
@inout promise: promise<int>;
}
}
}
events {
filter,name: Eio.Filter.Name.Data;
filter,direct: Eio.Filter.Direct.Data;
xattr: Eio.Filter.Name.Data;
}
implements {
Efl.Object.constructor;
Efl.Object.destructor;
}
}