• Home
  • Raw
  • Download

Lines Matching +full:has +full:- +full:flag

9 - seems to contain a bug when updating...
11 - reclaim free space (currently, space once occupied by deleted or expanded
14 - support concurrent access (currently, if two processes take turns making
17 - support efficient access to large databases (currently, the whole index
20 - support opening for read-only (flag = 'm')
37 # The on-disk directory and data files can remain in mutually
48 def __init__(self, filebasename, mode, flag='c'): argument
51 self._readonly = (flag == 'r')
62 # begins at a _BLOCKSIZE-aligned byte offset, and is a raw
63 # binary 8-bit string value.
67 # The index is an in-memory dict, mirroring the directory file.
71 self._create(flag)
72 self._update(flag)
74 def _create(self, flag): argument
75 if flag == 'n':
83 f = _io.open(self._datfile, 'r', encoding="Latin-1")
85 if flag not in ('c', 'n'):
87 with _io.open(self._datfile, 'w', encoding="Latin-1") as f:
92 # Read directory file into the in-memory index dict.
93 def _update(self, flag): argument
97 f = _io.open(self._dirfile, 'r', encoding="Latin-1")
99 if flag not in ('c', 'n'):
107 key = key.encode('Latin-1')
130 with self._io.open(self._dirfile, 'w', encoding="Latin-1") as f:
133 # Use Latin-1 since it has no qualms with any value in any
134 # position; UTF-8, though, does care sometimes.
135 entry = "%r, %r\n" % (key.decode('Latin-1'), pos_and_siz_pair)
142 raise error('DBM object has already been closed')
146 key = key.encode('utf-8')
154 # Append val to the data file, starting at a _BLOCKSIZE-aligned
162 npos = ((pos + _BLOCKSIZE - 1) // _BLOCKSIZE) * _BLOCKSIZE
163 f.write(b'\0'*(npos-pos))
180 # the in-memory index dict, and append one to the directory file.
183 with _io.open(self._dirfile, 'a', encoding="Latin-1") as f:
185 f.write("%r, %r\n" % (key.decode("Latin-1"), pos_and_siz_pair))
191 key = key.encode('utf-8')
195 val = val.encode('utf-8')
206 oldblocks = (siz + _BLOCKSIZE - 1) // _BLOCKSIZE
207 newblocks = (len(val) + _BLOCKSIZE - 1) // _BLOCKSIZE
218 # file. This also means that the on-disk directory and data
228 key = key.encode('utf-8')
234 # XXX has, so I'm not changing it). __setitem__ doesn't try to
243 raise error('DBM object has already been closed') from None
251 key = key.encode('utf-8')
256 raise error('DBM object has already been closed') from None
264 raise error('DBM object has already been closed') from None
271 raise error('DBM object has already been closed') from None
291 def open(file, flag='c', mode=0o666): argument
294 The flag argument, used to control how the database is opened in the
301 the database has to be created. It defaults to octal code 0o666 (and
315 if flag not in ('r', 'w', 'c', 'n'):
316 raise ValueError("Flag must be one of 'r', 'w', 'c', or 'n'")
317 return _Database(file, mode, flag=flag)