-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from KenyonY/fix/high_freq_writing_data_integrity
fix: Fixed data integrity during high-frequency writing
- Loading branch information
Showing
8 changed files
with
124 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
from .base import LevelDBDict, LMDBDict | ||
|
||
__version__ = "0.1.1" | ||
|
||
__all__ = [ | ||
"dbdict", | ||
"LMDBDict", | ||
"LevelDBDict", | ||
] | ||
|
||
|
||
def dbdict(path, backend='lmdb', recreate=False, **kwargs): | ||
def dbdict(path, backend='lmdb', rebuild=False, **kwargs): | ||
if backend == 'lmdb': | ||
return LMDBDict(path, recreate=recreate, **kwargs) | ||
return LMDBDict(path, rebuild=rebuild, **kwargs) | ||
elif backend == 'leveldb': | ||
return LevelDBDict(path, recreate=recreate) | ||
return LevelDBDict(path, rebuild=rebuild, **kwargs) | ||
else: | ||
raise ValueError(f"Unsupported DB type {backend}.") | ||
|
||
|
||
__version__ = "0.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import queue | ||
|
||
|
||
class SimpleQueue: | ||
def __init__(self, maxsize: int): | ||
self.q = queue.Queue(maxsize=maxsize) | ||
|
||
def put(self, item): | ||
if not self.q.full(): | ||
self.q.put(item) | ||
else: | ||
self.q.get() | ||
self.q.put(item) | ||
|
||
def get(self, block=True, timeout=None): | ||
return self.q.get(block=block, timeout=timeout) | ||
|
||
def empty(self): | ||
return self.q.empty() |
Oops, something went wrong.