Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
fix: remove file info in beansdb.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lianwenbo authored and windreamer committed Sep 28, 2017
1 parent 2e63e68 commit 1dd33c7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions dpark/beansdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import zlib
import cPickle
from dpark.util import get_logger
from dpark.file_manager import open_file
from dpark.serialize import load_func, dump_func

logger = get_logger(__name__)
Expand Down Expand Up @@ -142,14 +143,13 @@ def write_record(f, key, flag, value, version, ts):

class BeansdbReader(object):

def __init__(self, path, key_filter=None, fullscan=False, raw=False, fileinfo=None):
def __init__(self, path, key_filter=None, fullscan=False, raw=False):
if key_filter is None:
fullscan = True
self.path = path
self.key_filter = key_filter
self.fullscan = fullscan
self.raw = raw
self.fileinfo = fileinfo
if not fullscan:
hint = path[:-5] + '.hint'
if not os.path.exists(hint) and not os.path.exists(hint + '.qlz'):
Expand Down Expand Up @@ -222,10 +222,7 @@ def restore(self, value):
return value, err

def open_file(self):
if self.fileinfo:
return self.fileinfo
else:
return open(self.path, 'r', 4096 * 1024)
return open_file(self.path)

def full_scan(self, begin, end):
f = self.open_file()
Expand Down

0 comments on commit 1dd33c7

Please sign in to comment.