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