Added set_list at database.
[osm/common.git] / osm_common / fsbase.py
1 # -*- coding: utf-8 -*-
2
3 # Copyright 2018 Telefonica S.A.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 # implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18
19 from http import HTTPStatus
20
21 __author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
22
23
24 class FsException(Exception):
25 def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR):
26 self.http_code = http_code
27 Exception.__init__(self, "storage exception " + message)
28
29
30 class FsBase(object):
31 def __init__(self):
32 pass
33
34 def get_params(self):
35 return {}
36
37 def fs_connect(self, config):
38 pass
39
40 def fs_disconnect(self):
41 pass
42
43 def mkdir(self, folder):
44 raise FsException("Method 'mkdir' not implemented")
45
46 def file_exists(self, storage):
47 raise FsException("Method 'file_exists' not implemented")
48
49 def file_size(self, storage):
50 raise FsException("Method 'file_size' not implemented")
51
52 def file_extract(self, tar_object, path):
53 raise FsException("Method 'file_extract' not implemented")
54
55 def file_open(self, storage, mode):
56 raise FsException("Method 'file_open' not implemented")
57
58 def file_delete(self, storage, ignore_non_exist=False):
59 raise FsException("Method 'file_delete' not implemented")