-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (33 loc) · 1.1 KB
/
Copy pathmain.py
File metadata and controls
37 lines (33 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from core.logger import logger
from core.server import Server
from core.storage import KVStore
from core.aof.aof import AOF_V2
from core.commandhandler import CommandHandler
from config import load_config, WalConfig, ServerConfig
banner = """
____ _ _ ____ ____
/ ___|| (_) ___ ___ | _ \| __ )
\___ \| | |/ __/ _ \ | | | | _ \
___) | | | (_| __/ | |_| | |_) |
|____/|_|_|\___\___| |____/|____/
"""
if __name__ == "__main__":
load_config()
walFile = None
if WalConfig().wal_enable:
walFile = AOF_V2(WalConfig().path)
store = KVStore()
if walFile:
logger.info("Checking for AOF file")
logger.info("Replying the for AOF file")
walFile.replay(CommandHandler(store=store, walFile=None))
logger.info("Replying the for AOF file done")
command_handler = CommandHandler(store=store, walFile=walFile)
print(banner)
banner = None # clean-up allocated memeory for banner
Server(
host=ServerConfig().host,
port=ServerConfig().port,
store=store,
command_handler=command_handler,
).start_server()