I'm writing my own CRUD (more like URD) database -- for fun and possible production environment as I've needed a database which fits the requirements this one does for years.
PPDF: NoSQL Database
The code has default settings and also takes a settings.json file to customize things as needed. My settings.json file is (the codes reading it fine):
You can use the shell script to populate the DB with information:
PUSH {"username":{"password":"something cool"}}
At 500 bytes, it shouldn't take but a few seconds to fill with random info -- the first 200 are already done for you.
At the moment -- for troubleshooting -- I have the DB set up to print the size of the tickets variable every second.
When I push information to the database, the tickets var size increases but when it reaches the designated max value and I try to pop the first variable, I get this error:
Sorry if there's an edit button but I couldn't find it. On further examination of my output:
This was the numerical output. I added one new entry after it said 460 (to push it over 500. As you can see, I succeeded and it starts popping entries but never goes below 500).
PPDF: NoSQL Database
The code has default settings and also takes a settings.json file to customize things as needed. My settings.json file is (the codes reading it fine):
{ "db_path": "__mem__", "mem_max": 500 }The __mem__ setting tells the DB to store all entries in memory only and the mem_max tells the DB maximum permissible size of memory-based storage. When the DB exceeds said storage limit, the first entry is to be popped from the tickets variable (which is where memory is stored or variables wait to be written to disk in a non-memory-based DB).
You can use the shell script to populate the DB with information:
PUSH {"username":{"password":"something cool"}}
At 500 bytes, it shouldn't take but a few seconds to fill with random info -- the first 200 are already done for you.
At the moment -- for troubleshooting -- I have the DB set up to print the size of the tickets variable every second.
When I push information to the database, the tickets var size increases but when it reaches the designated max value and I try to pop the first variable, I get this error:
Error:Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\mary\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\mary\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "E:\PPDF\ppdf.py", line 89, in memMaxThread
tickets.popitem()
KeyError: 'dictionary is empty'
Again, I was expecting it to just pop the first ticket. I considered that maybe it was a matter of scope but then, why would the function be able to access tickets to get the size?Sorry if there's an edit button but I couldn't find it. On further examination of my output:
This was the numerical output. I added one new entry after it said 460 (to push it over 500. As you can see, I succeeded and it starts popping entries but never goes below 500).
Output:PPDF V18.05.29 IS RUNNING
========================================
PORT: 5044
200
200
200
200
200
200
200
200
216
216
216
216
216
216
216
216
232
232
232
232
232
232
232
232
232
232
232
232
232
232
248
248
248
248
248
248
248
248
248
264
264
264
264
280
280
280
280
280
396
396
412
412
412
428
428
428
428
444
444
444
444
460
460
460
688
672
656
640
624
608
592
576
560
544
528
512