mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 15:05:49 +00:00
_spacing_
This commit is contained in:
parent
56c8f72570
commit
9676578e6c
@ -4,31 +4,27 @@ from planetmint.backend.tarantool.utils import run
|
||||
|
||||
|
||||
class TarantoolDB:
|
||||
def __init__(self , host , port , username , password):
|
||||
self.conn = tarantool.connect(host=host , port=port , user = username , password=password)
|
||||
def __init__(self, host, port, username, password):
|
||||
self.conn = tarantool.connect(host=host, port=port, user=username, password=password)
|
||||
|
||||
|
||||
def connect_to_sapce(self,spacename):
|
||||
def connect_to_sapce(self, spacename):
|
||||
self.conn.space(spacename)
|
||||
|
||||
|
||||
def init_tarantool():
|
||||
if os.path.exists(os.path.join(os.getcwd(), 'tarantool', 'init.lua')) is not True:
|
||||
path = os.getcwd()
|
||||
run(["mkdir" , "tarantool_snap"])
|
||||
run(["ln","-s",path +"/init.lua","init.lua"] , path+"/tarantool_snap")
|
||||
run (["tarantool" , "init.lua"] ,path+ "/tarantool")
|
||||
run(["mkdir", "tarantool_snap"])
|
||||
run(["ln", "-s", path + "/init.lua", "init.lua"], path + "/tarantool_snap")
|
||||
run(["tarantool", "init.lua"], path + "/tarantool")
|
||||
else:
|
||||
raise Exception("There is a instance of tarantool already created in %s" + os.getcwd() + "/tarantool_snap")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def drop_tarantool():
|
||||
if os.path.exists(os.path.join(os.getcwd(), 'tarantool', 'init.lua')) is not True:
|
||||
path = os.getcwd()
|
||||
run(["ln","-s",path +"/drop_db.lua","drop_db.lua"] , path+"/tarantool_snap")
|
||||
run (["tarantool" , "drop_db.lua"])
|
||||
run(["ln", "-s", path + "/drop_db.lua", "drop_db.lua"], path + "/tarantool_snap")
|
||||
run(["tarantool", "drop_db.lua"])
|
||||
else:
|
||||
raise Exception("There is no tarantool spaces to drop")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user