1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 from flumotion.component.plugs import base as plugbase
19
20
22 """
23 I am raised when a File or a FilePath operation failed.
24 Like trying to get the size or open a file that does not exists.
25 """
26
27
29 """
30 I am raised when trying an operation on a file that changed since
31 it has been open, and nothing can be done to ensure the integrity
32 of the data.
33 """
34
35
37 """
38 I am raised when trying to build an insecure path using FilePath.
39 For example, when trying to retrieve a child with a name that
40 contains insecure characters like os.sep .
41 """
42
43
45 """
46 I am raised when trying to retrieve a child that does nor exists,
47 or do an operation on a file that does not exists.
48 """
49
50
52 """
53 I am raised when trying to open a path that is not a file.
54 """
55
56
58 """
59 I am raised when a file operation failed because of right restriction.
60 """
61
62
64 """
65 I am raised when trying to do some operation on a closed file.
66 """
67
68
70 """
71 I am raised when a plug cannot provide the requested service.
72 """
73
74
76 """
77 I am pointing at a path in the file repository.
78 I can point at a file or at a directory.
79 I can open the pointed file object.
80 I'm used to browse file repository to lookup for file.
81 """
82
84 """
85 @return: the mime type of the pointed file or None if unknown
86 @rtype: str
87 """
88 mimeType = property(getMimeType)
89
91 """
92 @param name: the name of a child of the pointed directory
93 @type name: str
94
95 @return: a FilePath that point at the specified child
96 @rtype: L{MediaPath}
97 @raises NotFoundError: if the child does not exists
98 @raises InsecureError: if the specified name compromise security
99 """
100
102 """
103 @return: the pointed file opened as an asynchronous file
104 or a deferred that will be called back with one.
105 @rtype: L{AsyncFile} | L{defer.Deferred}
106 @raises NotFoundError: if the file does not exists anymore
107 @raises AccessError: if the file cannot be opened
108 because of right restriction
109 """
110
111
113 """
114 I am an asynchronous interface to a file.
115 I can be read and written asynchronously.
116 """
117
119 """
120 @return: the mime type of the file or None if unknown
121 @rtype: str
122 """
123 mimeType = property(getMimeType)
124
126 """
127 @return: the modification time of the file
128 @rtype: int
129 """
130
132 """
133 @return: the size of the file
134 @rtype: long
135 """
136
138 """
139 @returns: the current read/write position in the file
140 @rtype: long
141 """
142
143 - def seek(self, offset):
144 """
145 Moves the reading/writing position inside the file.
146 Only support absolute offset from file start.
147
148 @param offset: the byte offset from the start of the file to go to
149 @type offset: long
150 """
151
152 - def read(self, size):
153 """
154 Reads the specified amount of data asynchronously.
155
156 @param size: the amount of byte to read from the file
157 @type size: int
158
159 @return: a deferred fired with the read data or a failure.
160 The data can be empty or smaller than the wanted size
161 if the end of file is reached.
162 @type: L{defer.Deferred}
163 """
164
166 """
167 Close and cleanup the file.
168 """
169
171 """
172 @returns: a dictionary of log fields related to the file usage
173 @rtype: dict
174 """
175
176
178 """
179 I am a plug that provide a root FilePath instance
180 that can be used to lookup and open file objects.
181 """
182
184 """
185 Start updating statistics.
186 """
187
189 """
190 Stop updating statistics.
191 """
192
194 """
195 @return: the root of the file repository
196 @rtype: L{FilePath}
197 """
198