Skip to content

Commit 74895dc

Browse files
author
keenondrums
committed
[WIP] Incubation - File Structure Refactoring
1 parent 7bfbdb0 commit 74895dc

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

plenum/client/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def __init__(self,
6767
:param ha: tuple of host and port
6868
"""
6969
self.config = config or getConfig()
70-
basedirpath = self.config.baseDir if not basedirpath else basedirpath
71-
self.basedirpath = basedirpath
70+
self.basedirpath = basedirpath or os.path.join(self.config.baseDir,
71+
self.config.NETWORK_NAME)
7272

7373
signer = Signer(sighex)
7474
sighex = signer.keyraw
@@ -82,9 +82,9 @@ def __init__(self,
8282

8383
cha = None
8484
# If client information already exists is RAET then use that
85-
if self.exists(self.stackName, basedirpath):
85+
if self.exists(self.stackName, self.basedirpath):
8686
cha = self.nodeStackClass.getHaFromLocal(
87-
self.stackName, basedirpath)
87+
self.stackName, self.basedirpath)
8888
if cha:
8989
cha = HA(*cha)
9090
logger.debug("Client {} ignoring given ha {} and using {}".

plenum/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
('DeltaC', ('127.0.0.1', 9708))
2525
])
2626

27-
baseDir = '~/.plenum/networks/'
27+
baseDir = '~/.plenum/'
2828
walletsDir = 'wallets'
29+
NODE_BASE_DATA_DIR = '/var/plenum'
2930
nodeDataDir = 'data/nodes'
3031
clientDataDir = 'data/clients'
3132
LOG_DIR = '/var/log/plenum/'

plenum/server/node.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def __init__(self,
110110
cliname: str=None,
111111
cliha: HA=None,
112112
basedirpath: str=None,
113+
base_data_dir: str=None,
113114
primaryDecider: PrimaryDecider = None,
114115
pluginPaths: Iterable[str]=None,
115116
storage: Storage=None,
@@ -128,12 +129,14 @@ def __init__(self,
128129
self.created = time.time()
129130
self.name = name
130131
self.config = config or getConfig()
131-
self.basedirpath = basedirpath or config.baseDir
132+
self.basedirpath = basedirpath or os.path.join(config.baseDir, config.NETWORK_NAME)
132133
self.dataDir = self.config.nodeDataDir or "data/nodes"
134+
self.base_data_dir = base_data_dir or os.path.join(self.config.NODE_BASE_DATA_DIR,
135+
config.NETWORK_NAME)
133136

134137
self._view_change_timeout = self.config.VIEW_CHANGE_TIMEOUT
135138

136-
HasFileStorage.__init__(self, name, baseDir=self.basedirpath,
139+
HasFileStorage.__init__(self, name, baseDir=self.base_data_dir,
137140
dataDir=self.dataDir)
138141
self.ensureKeysAreSetup()
139142
self.opVerifiers = self.getPluginsByType(pluginPaths,

0 commit comments

Comments
 (0)