summaryrefslogtreecommitdiff
path: root/src/lib/eio/eio_job.eo
blob: c7fa877f5d53a5d132e0d0b366b3297cef5c7602 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import eina_types;

struct Eio.Data
{
  [[A structure to handle arbitrary data to be sent over Promises.]]
  data: void_ptr;
  size: uint;
}

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;
}

class Eio.Job (Eo.Base)
{
  [[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 {
    Eo.Base.constructor;
    Eo.Base.destructor;
  }
}