summaryrefslogtreecommitdiff
path: root/src/lib/eio/eio_job.eo
blob: 3a12d23e92c87300cf5960de3990525e8292af75 (plain)
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
147
148
149
150
151
152
import eina_types;

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

struct Eio.Filter.Direct.Data
{
  info: const(Eina.File.Direct.Info)*;
  filter: bool;
}

struct Eio.Filter.Name.Data
{
  file: const(char)*;
  filter: bool;
}

struct Eio.Xattr.Data
{
  data: const(char)*;
  size: uint;
}

class Eio.Job (Eo.Base)
{
  [[Class representing an asynchronous file operation.]]

  legacy_prefix: null;

  methods {

    // Listing operations
    file_ls {
      [[Lists entries in a given path.]]
      params {
        @in path: const(char)*;
        @inout promise: promise<int, const(char)*>;
      }
    }

    file_direct_ls {
      [[Lists entries in a given path with more information.]]
      params {
        @in path: const(char)*;
        @inout promise: promise<int, const(Eina_File_Direct_Info)*>;
      }
    }

    file_stat_ls {
      [[Lists entries in a given path with stat information.]]
      params {
        @in path: const(char)*;
        @inout promise: promise<int, const(Eina_File_Direct_Info)*>;
      }
    }

    dir_stat_ls {
      [[Recursively list the directory content and its sub content.]]
      params {
        @in path: const(char)*;
        @inout promise: promise<int, const(Eina_File_Direct_Info)*>;
      }
    }

    dir_direct_ls {
      [[Recursively list the directory content and its sub content.]]
      params {
        @in path: const(char)*;
        @inout promise: promise<int, const(Eina_File_Direct_Info)*>;
      }
    }

    file_direct_stat {
      [[Get stat info on a given file/directory.]]
      params {
        @in path: const(char)*;
        @inout promise: promise<const(Eina_Stat)*>; //TODO Change to a delayed promise.
      }
    }

    // Extended attributes

    file_xattr {
      [[Lists all extended attributes asynchronously.]]
      params {
        @in path: const(char)*;
        @inout promise: promise<int, const(char)*>;
      }
    }

    file_xattr_set {
      [[Sets a given extended attribute.]]
      params {
        @in path: const(char)*;
        @in attribute: const(char)*;
        @in xattr_data: const(char)*;
        @in xattr_size: uint;
        @in flags: Eina.Xattr.Flags;
        @inout promise: promise<int>;
      }
    }

    file_xattr_get {
      [[Sets a given extended attribute.]]
      params {
        @in path: const(char)*;
        @in attribute: const(char)*;
        @inout promise: promise<Eio.Xattr.Data*>;
      }
    }

    // helper api
    file_open {
      [[Opens a file.

      The fulfilled value in the promise will be the Eina.File*.]]
      params {
        @in path: const(char)*;
        @in shared: bool;
        @inout promise: 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>;
      }
    }
    cancel_all {
      [[Cancels all pending operations on this job.]]
      params {
        // Shall we need some promise here?
      }
    }
  }
 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;
  }
}