Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
d9a9df8b
Commit
d9a9df8b
authored
Sep 02, 2010
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed untested unsupported dbmstorage fossil.
parent
5a9afb14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
117 deletions
+0
-117
src/ZODB/dbmStorage.py
src/ZODB/dbmStorage.py
+0
-117
No files found.
src/ZODB/dbmStorage.py
deleted
100644 → 0
View file @
5a9afb14
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Very Simple dbm-based ZODB storage
This storage provides for use of dbm files as storages that
don't support versions or Undo. This may be useful when implementing
objects like hit counters that don't need or want to participate
in undo or versions.
"""
from
ZODB.utils
import
z64
from
MappingStorage
import
MappingStorage
from
BaseStorage
import
BaseStorage
import
anydbm
,
os
class
anydbmStorage
(
MappingStorage
):
def
__init__
(
self
,
filename
,
flag
=
'r'
,
mode
=
0666
):
BaseStorage
.
__init__
(
self
,
filename
)
self
.
_index
=
anydbm
.
open
(
filename
,
flag
,
mode
)
self
.
_tindex
=
[]
keys
=
self
.
_index
.
keys
()
if
keys
:
self
.
_oid
=
max
(
keys
)
def
getSize
(
self
):
# This is a little iffy, since we aren't entirely sure what the file is
self
.
_lock_acquire
()
try
:
try
:
return
(
os
.
stat
(
self
.
__name__
+
'.data'
)[
6
]
+
os
.
stat
(
self
.
__name__
+
'.dir'
)[
6
]
)
except
:
try
:
return
os
.
stat
(
self
.
__name__
)[
6
]
except
:
return
0
finally
:
self
.
_lock_release
()
class
gdbmStorage
(
anydbmStorage
):
def
__init__
(
self
,
filename
,
flag
=
'r'
,
mode
=
0666
):
BaseStorage
.
__init__
(
self
,
filename
)
import
gdbm
self
.
_index
=
index
=
gdbm
.
open
(
filename
,
flag
[:
1
]
+
'f'
,
mode
)
self
.
_tindex
=
[]
m
=
z64
oid
=
index
.
firstkey
()
while
oid
!=
None
:
m
=
max
(
m
,
oid
)
oid
=
index
.
nextkey
(
oid
)
self
.
_oid
=
m
def
getSize
(
self
):
self
.
_lock_acquire
()
try
:
return
os
.
stat
(
self
.
__name__
)[
6
]
finally
:
self
.
_lock_release
()
def
pack
(
self
,
t
,
referencesf
):
self
.
_lock_acquire
()
try
:
# Build an index of *only* those objects reachable
# from the root.
index
=
self
.
_index
rootl
=
[
z64
]
pop
=
rootl
.
pop
pindex
=
{}
referenced
=
pindex
.
has_key
while
rootl
:
oid
=
pop
()
if
referenced
(
oid
):
continue
# Scan non-version pickle for references
r
=
index
[
oid
]
pindex
[
oid
]
=
r
p
=
r
[
8
:]
referencesf
(
p
,
rootl
)
# Now delete any unreferenced entries:
deleted
=
[]
oid
=
index
.
firstkey
()
while
oid
!=
None
:
if
not
referenced
(
oid
):
deleted
.
append
(
oid
)
oid
=
index
.
nextkey
(
oid
)
pindex
=
referenced
=
None
for
oid
in
deleted
:
del
index
[
oid
]
index
.
sync
()
index
.
reorganize
()
finally
:
self
.
_lock_release
()
def
_finish
(
self
,
tid
,
user
,
desc
,
ext
):
index
=
self
.
_index
for
oid
,
p
in
self
.
_tindex
:
index
[
oid
]
=
p
index
.
sync
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment