You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Draft version adding to the traditional sequential backend also sqlite3
and file based concurrent ones.
Closes: #3097
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
# See the LICENSE file in the source distribution for further information.
10
10
11
-
importre
12
-
13
-
fromthreadingimportLock
11
+
importre, os, tempfile
12
+
importsqlite3, time
13
+
frompathlibimportPath
14
14
15
15
16
16
classSoSMap():
@@ -28,11 +28,41 @@ class SoSMap():
28
28
ignore_short_items=False
29
29
match_full_words_only=False
30
30
31
-
def__init__(self):
32
-
self.dataset= {}
31
+
def__init__(self, concur_backend, workdir):
32
+
# TODO: ALL mappings must be deterministic; NO randomization in hostname or ip(6) mapper!
33
+
self.dataset= {} # TODO: mention the child classes can update it as well as add_sanitised_item_to_dataset method, so sqlite or files dont neet to have all counter values stored; e.g. when adding an IP address - sqlite and files approach guarantees same input is added in all processes at the same ordering - it can add a new network to the dataset. So dataset bumps by 2
33
34
self._regexes_made=set()
34
35
self.compiled_regexes= []
35
-
self.lock=Lock()
36
+
self.cname=self.__class__.__name__.lower()
37
+
# TODO: ensure the directory <workdir> does exist - but only when concur_backend='files'
38
+
# TODO: deal with permissions..? IMHO default ones are OK
39
+
self.workdir=workdir
40
+
self.link_dir=os.path.join(self.workdir, 'cleaner_links', self.cname) #TODO: some better dir name?
41
+
self.concur_backend=concur_backend
42
+
self.load_entries()
43
+
44
+
defunload_entries(self):
45
+
self.sqlconn=self.sqlcursor=None
46
+
47
+
defload_entries(self): # originally this was in __init__, but we need to trigger after cloning processes, and also reload content in files or sqlite DB in parent archive class, once children are done
48
+
# TODO: call load_entries at beginning of obfuscation (list of) *files*
0 commit comments