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 to build an insecure path using FilePath.
35 For example, when trying to retrieve a child with a name that
36 contains insecure characters like os.sep .
37 """
38
39
41 """
42 I am raised when trying to retrieve a child that does nor exists,
43 or do an operation on a file that does not exists.
44 """
45
46
48 """
49 I am raised when trying to open a path that is not a file.
50 """
51
52
54 """
55 I am raised when a file operation failed because of right restriction.
56 """
57
58
60 """
61 I am raised when trying to do some operation on a closed file.
62 """
63
64
66 """
67 I am pointing at a path in the file repository.
68 I can point at a file or at a directory.
69 I can open the pointed file object.
70 I'm used to browse file repository to lookup for file.
71 """
72
74 """
75 @return: the mime type of the pointed file or None if unknown
76 @rtype: str
77 """
78 mimeType = property(getMimeType)
79
81 """
82 @param name: the name of a child of the pointed directory
83 @type name: str
84
85 @return: a FilePath that point at the specified child
86 @rtype: L{MediaPath}
87 @raises NotFoundError: if the child does not exists
88 @raises InsecureError: if the specified name compromise security
89 """
90
92 """
93 @return: the pointed file opened as an asynchronous file
94 @rtype: L{AsyncFile}
95 @raises NotFoundError: if the file does not exists anymore
96 @raises AccessError: if the file cannot be opened
97 because of right restriction
98 """
99
100
102 """
103 I am an asynchronous interface to a file.
104 I can be read and written asynchronously.
105 """
106
108 """
109 @return: the mime type of the file or None if unknown
110 @rtype: str
111 """
112 mimeType = property(getMimeType)
113
115 """
116 @return: the modification time of the file
117 @rtype: int
118 """
119
121 """
122 @return: the size of the file
123 @rtype: long
124 """
125
127 """
128 @returns: the current read/write position in the file
129 @rtype: long
130 """
131
132 - def seek(self, offset):
133 """
134 Moves the reading/writing position inside the file.
135 Only support absolute offset from file start.
136
137 @param offset: the byte offset from the start of the file to go to
138 @type offset: long
139 """
140
141 - def read(self, size):
142 """
143 Reads the specified amount of data asynchronously.
144
145 @param size: the amount of byte to read from the file
146 @type size: int
147
148 @return: a deferred fired with the read data or a failure.
149 The data can be empty or smaller than the wanted size
150 if the end of file is reached.
151 @type: L{defer.Deferred}
152 """
153
155 """
156 Close and cleanup the file.
157 """
158
160 """
161 @returns: a dictionary of log fields related to the file usage
162 @rtype: dict
163 """
164
165
167 """
168 I am a plug that provide a root FilePath instance
169 that can be used to lookup and open file objects.
170 """
171
173 """
174 Start updating statistics.
175 """
176
178 """
179 Stop updating statistics.
180 """
181
183 """
184 @return: the root of the file repository
185 @rtype: L{FilePath}
186 """
187