Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tempstorage
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
nexedi
tempstorage
Commits
e83aad47
Commit
e83aad47
authored
Jul 05, 2021
by
Jens Vagelpohl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Update package configuration
parent
40aaf1b3
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
200 additions
and
32 deletions
+200
-32
.editorconfig
.editorconfig
+39
-0
.github/workflows/tests.yml
.github/workflows/tests.yml
+11
-1
.gitignore
.gitignore
+26
-10
.meta.toml
.meta.toml
+23
-0
CHANGES.rst
CHANGES.rst
+2
-0
MANIFEST.in
MANIFEST.in
+3
-0
setup.cfg
setup.cfg
+9
-2
setup.py
setup.py
+14
-6
src/tempstorage/TemporaryStorage.py
src/tempstorage/TemporaryStorage.py
+4
-5
src/tempstorage/tests/testTemporaryStorage.py
src/tempstorage/tests/testTemporaryStorage.py
+9
-4
tox.ini
tox.ini
+60
-4
No files found.
.editorconfig
0 → 100644
View file @
e83aad47
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
#
# EditorConfig Configuration file, for more details see:
# http://EditorConfig.org
# EditorConfig is a convention description, that could be interpreted
# by multiple editors to enforce common coding conventions for specific
# file types
# top-most EditorConfig file:
# Will ignore other EditorConfig files in Home directory or upper tree level.
root = true
[*] # For All Files
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Set default charset
charset = utf-8
# Indent style default
indent_style = space
# Max Line Length - a hard line wrap, should be disabled
max_line_length = off
[*.{py,cfg,ini}]
# 4 space indentation
indent_size = 4
[*.{yml,zpt,pt,dtml,zcml}]
# 2 space indentation
indent_size = 2
[{Makefile,.gitmodules}]
# Tab indentation (no size specified, but view as 4 spaces)
indent_style = tab
indent_size = unset
tab_width = unset
.github/workflows/tests.yml
View file @
e83aad47
# based on https://github.com/zopefoundation/meta/blob/master/config/default/tests.yml.j2
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
name
:
tests
name
:
tests
on
:
on
:
...
@@ -19,6 +20,7 @@ jobs:
...
@@ -19,6 +20,7 @@ jobs:
-
ubuntu
-
ubuntu
config
:
config
:
# [Python version, tox env]
# [Python version, tox env]
-
[
"
3.8"
,
"
lint"
]
-
[
"
2.7"
,
"
py27"
]
-
[
"
2.7"
,
"
py27"
]
-
[
"
3.5"
,
"
py35"
]
-
[
"
3.5"
,
"
py35"
]
-
[
"
3.6"
,
"
py36"
]
-
[
"
3.6"
,
"
py36"
]
...
@@ -27,6 +29,7 @@ jobs:
...
@@ -27,6 +29,7 @@ jobs:
-
[
"
3.9"
,
"
py39"
]
-
[
"
3.9"
,
"
py39"
]
-
[
"
pypy2"
,
"
pypy"
]
-
[
"
pypy2"
,
"
pypy"
]
-
[
"
pypy3"
,
"
pypy3"
]
-
[
"
pypy3"
,
"
pypy3"
]
-
[
"
3.8"
,
"
coverage"
]
runs-on
:
${{ matrix.os }}-latest
runs-on
:
${{ matrix.os }}-latest
name
:
${{ matrix.config[1] }}
name
:
${{ matrix.config[1] }}
...
@@ -50,3 +53,10 @@ jobs:
...
@@ -50,3 +53,10 @@ jobs:
pip install tox
pip install tox
-
name
:
Test
-
name
:
Test
run
:
tox -e ${{ matrix.config[1] }}
run
:
tox -e ${{ matrix.config[1] }}
-
name
:
Coverage
if
:
matrix.config[1] == 'coverage'
run
:
|
pip install coveralls coverage-python-version
coveralls --service=github
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
.gitignore
View file @
e83aad47
bin
# Generated from:
build
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
dist
*.egg-info/
lib
*.profraw
parts
develop-eggs
*.dll
*.pyc
*.pyc
*.pyo
*.pyo
*.so
*.so
.coverage
.coverage.*
.eggs/
.installed.cfg
.installed.cfg
.tox
.mr.developer.cfg
*.egg-info
.tox/
.vscode/
__pycache__/
bin/
build/
coverage.xml
develop-eggs/
develop/
dist/
docs/_build
eggs/
etc/
lib/
lib64
log/
parts/
pyvenv.cfg
var/
.meta.toml
0 → 100644
View file @
e83aad47
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template
=
"pure-python"
commit-id
=
"2a88c4b047cb9e8df85901519c92d97f469e25de"
[python]
with-windows
=
false
with-pypy
=
true
with-future-python
=
false
with-legacy-python
=
true
with-sphinx-doctests
=
false
[tox]
use-flake8
=
true
[coverage]
fail-under
=
68
[manifest]
additional-rules
=
[
"recursive-include src *.xml"
,
]
CHANGES.rst
View file @
e83aad47
...
@@ -4,6 +4,8 @@ Changelog
...
@@ -4,6 +4,8 @@ Changelog
5.2 (unreleased)
5.2 (unreleased)
----------------
----------------
- Update package configuration
- Package is now officially undeprecated because the data corruption issue -
- Package is now officially undeprecated because the data corruption issue -
that was the reason for its deprecation - has been understood and fixed. See
that was the reason for its deprecation - has been understood and fixed. See
(`#16 <https://github.com/zopefoundation/tempstorage/issues/16>`_).
(`#16 <https://github.com/zopefoundation/tempstorage/issues/16>`_).
...
...
MANIFEST.in
View file @
e83aad47
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
include *.rst
include *.rst
include *.txt
include *.txt
include buildout.cfg
include buildout.cfg
include tox.ini
include tox.ini
recursive-include src *.py
recursive-include src *.xml
recursive-include src *.xml
setup.cfg
View file @
e83aad47
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[bdist_wheel]
[bdist_wheel]
universal = 1
universal = 1
[zest.releaser]
[flake8]
create-wheel = yes
doctests = 1
[check-manifest]
ignore =
.editorconfig
.meta.toml
setup.py
View file @
e83aad47
...
@@ -14,28 +14,36 @@
...
@@ -14,28 +14,36 @@
"""Setup for the tempstorage package
"""Setup for the tempstorage package
"""
"""
from
setuptools
import
setup
,
find_packages
from
setuptools
import
find_packages
from
setuptools
import
setup
long_description
=
(
open
(
"README.rst"
).
read
()
+
"
\
n
"
+
long_description
=
(
open
(
"README.rst"
).
read
()
+
"
\
n
"
+
open
(
"CHANGES.rst"
).
read
())
open
(
"CHANGES.rst"
).
read
())
version
=
'5.2.dev0'
version
=
'5.2.dev0'
__version__
=
version
__version__
=
version
setup
(
name
=
'tempstorage'
,
setup
(
name
=
'tempstorage'
,
version
=
__version__
,
version
=
__version__
,
url
=
'https://github.com/zopefoundation/tempstorage'
,
url
=
'https://github.com/zopefoundation/tempstorage'
,
project_urls
=
{
'Issue Tracker'
:
(
'https://github.com/zopefoundation/'
'tempstorage/issues'
),
'Sources'
:
'https://github.com/zopefoundation/tempstorage'
,
},
license
=
'ZPL 2.1'
,
license
=
'ZPL 2.1'
,
description
=
'A RAM-based storage for ZODB'
,
description
=
'A RAM-based storage for ZODB'
,
author
=
'Zope Foundation and Contributors'
,
author
=
'Zope Foundation and Contributors'
,
author_email
=
'zope-dev@zope.org'
,
author_email
=
'zope-dev@zope.org'
,
long_description
=
long_description
,
long_description
=
long_description
,
classifiers
=
[
classifiers
=
[
"Development Status ::
7 - Inactiv
e"
,
"Development Status ::
6 - Matur
e"
,
"Environment :: Web Environment"
,
"Environment :: Web Environment"
,
"Framework :: ZODB"
,
"Framework :: ZODB"
,
"Framework :: Zope"
,
"Framework :: Zope"
,
"Framework :: Zope :: 4"
,
"Framework :: Zope :: 4"
,
"Framework :: Zope :: 5"
,
"Intended Audience :: Developers"
,
"Intended Audience :: Developers"
,
"License :: OSI Approved"
,
"License :: OSI Approved"
,
"License :: OSI Approved :: Zope Public License"
,
"License :: OSI Approved :: Zope Public License"
,
...
@@ -57,15 +65,15 @@ setup(name='tempstorage',
...
@@ -57,15 +65,15 @@ setup(name='tempstorage',
],
],
packages
=
find_packages
(
'src'
),
packages
=
find_packages
(
'src'
),
package_dir
=
{
''
:
'src'
},
package_dir
=
{
''
:
'src'
},
python_requires
=
'>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*'
,
install_requires
=
[
install_requires
=
[
'setuptools'
,
'setuptools'
,
'ZODB >= 5.
0
'
,
'ZODB >= 5.
6
'
,
'zope.testing'
,
'zope.testing'
,
],
],
extras_require
=
{
extras_require
=
{
'test'
:
[
'test'
:
[
'mock'
,
'zope.testrunner'
,
'zope.testrunner'
],
],
},
},
include_package_data
=
True
,
include_package_data
=
True
,
...
...
src/tempstorage/TemporaryStorage.py
View file @
e83aad47
...
@@ -19,7 +19,6 @@ resolution.
...
@@ -19,7 +19,6 @@ resolution.
This is a ripoff of Jim's Packless bsddb3 storage.
This is a ripoff of Jim's Packless bsddb3 storage.
"""
"""
import
bisect
import
bisect
import
warnings
import
time
import
time
from
ZODB
import
POSException
from
ZODB
import
POSException
...
@@ -116,17 +115,17 @@ class TemporaryStorage(BaseStorage, ConflictResolvingStorage):
...
@@ -116,17 +115,17 @@ class TemporaryStorage(BaseStorage, ConflictResolvingStorage):
if
now
>
(
self
.
_last_cache_gc
+
self
.
_conflict_cache_gcevery
):
if
now
>
(
self
.
_last_cache_gc
+
self
.
_conflict_cache_gcevery
):
# build {} oid -> [](serial, data, t)
# build {} oid -> [](serial, data, t)
byoid
=
{}
byoid
=
{}
for
((
oid
,
serial
),
(
data
,
t
))
in
self
.
_conflict_cache
.
items
():
for
((
oid
,
serial
),
(
data
,
t
))
in
self
.
_conflict_cache
.
items
():
hist
=
byoid
.
setdefault
(
oid
,
[])
hist
=
byoid
.
setdefault
(
oid
,
[])
hist
.
append
((
serial
,
data
,
t
))
hist
.
append
((
serial
,
data
,
t
))
# gc entries but keep latest record for each oid
# gc entries but keep latest record for each oid
for
oid
,
hist
in
byoid
.
items
():
for
oid
,
hist
in
byoid
.
items
():
hist
.
sort
(
key
=
lambda
_
:
_
[
0
])
# by serial
hist
.
sort
(
key
=
lambda
_
:
_
[
0
])
# by serial
hist
=
hist
[:
-
1
]
# without latest record
hist
=
hist
[:
-
1
]
# without latest record
for
serial
,
data
,
t
in
hist
:
for
serial
,
data
,
t
in
hist
:
if
now
>
(
t
+
self
.
_conflict_cache_maxage
):
if
now
>
(
t
+
self
.
_conflict_cache_maxage
):
del
self
.
_conflict_cache
[(
oid
,
serial
)]
del
self
.
_conflict_cache
[(
oid
,
serial
)]
self
.
_last_cache_gc
=
now
self
.
_last_cache_gc
=
now
self
.
_tmp
=
[]
self
.
_tmp
=
[]
...
...
src/tempstorage/tests/testTemporaryStorage.py
View file @
e83aad47
...
@@ -135,7 +135,7 @@ class TemporaryStorageTests(unittest.TestCase):
...
@@ -135,7 +135,7 @@ class TemporaryStorageTests(unittest.TestCase):
r2
=
storage
.
tpc_vote
(
t
)
r2
=
storage
.
tpc_vote
(
t
)
revid
=
handle_serials
(
oid
,
r1
,
r2
)
revid
=
handle_serials
(
oid
,
r1
,
r2
)
storage
.
tpc_finish
(
t
)
storage
.
tpc_finish
(
t
)
except
:
except
:
# noqa: E722 bare except
storage
.
tpc_abort
(
t
)
storage
.
tpc_abort
(
t
)
raise
raise
return
revid
return
revid
...
@@ -181,7 +181,8 @@ class TemporaryStorageTests(unittest.TestCase):
...
@@ -181,7 +181,8 @@ class TemporaryStorageTests(unittest.TestCase):
storage
.
_conflict_cache_gcevery
=
1
# second
storage
.
_conflict_cache_gcevery
=
1
# second
storage
.
_conflict_cache_maxage
=
1
# second
storage
.
_conflict_cache_maxage
=
1
# second
# assertCacheKeys asserts that set(storage._conflict_cache.keys()) == oidrevSet
# assertCacheKeys asserts that
# set(storage._conflict_cache.keys()) == oidrevSet
# storage._conflict_cache is organized as {} (oid,rev) -> (data,t) and
# storage._conflict_cache is organized as {} (oid,rev) -> (data,t) and
# so is used by loadBefore as data storage. It is important that latest
# so is used by loadBefore as data storage. It is important that latest
# revision of an object is not garbage-collected so that loadBefore
# revision of an object is not garbage-collected so that loadBefore
...
@@ -191,7 +192,8 @@ class TemporaryStorageTests(unittest.TestCase):
...
@@ -191,7 +192,8 @@ class TemporaryStorageTests(unittest.TestCase):
self
.
assertEqual
(
set
(
storage
.
_conflict_cache
.
keys
()),
oidrevOK
)
self
.
assertEqual
(
set
(
storage
.
_conflict_cache
.
keys
()),
oidrevOK
)
# make sure that loadBefore actually uses ._conflict_cache data
# make sure that loadBefore actually uses ._conflict_cache data
for
(
oid
,
rev
)
in
voidrevOK
:
for
(
oid
,
rev
)
in
voidrevOK
:
load_data
,
load_serial
,
_
=
storage
.
loadBefore
(
oid
,
p64
(
u64
(
rev
)
+
1
))
load_data
,
load_serial
,
_
=
storage
.
loadBefore
(
oid
,
p64
(
u64
(
rev
)
+
1
))
data
,
t
=
storage
.
_conflict_cache
[(
oid
,
rev
)]
data
,
t
=
storage
.
_conflict_cache
[(
oid
,
rev
)]
self
.
assertEqual
((
load_data
,
load_serial
),
(
data
,
rev
))
self
.
assertEqual
((
load_data
,
load_serial
),
(
data
,
rev
))
...
@@ -224,7 +226,10 @@ class TemporaryStorageTests(unittest.TestCase):
...
@@ -224,7 +226,10 @@ class TemporaryStorageTests(unittest.TestCase):
rev41
=
storage
.
lastTransaction
()
rev41
=
storage
.
lastTransaction
()
# (oid2, rev21) garbage-collected
# (oid2, rev21) garbage-collected
assertCacheKeys
((
oid1
,
rev12
),
(
oid2
,
rev22
),
(
oid3
,
rev31
),
(
oid4
,
rev41
))
assertCacheKeys
((
oid1
,
rev12
),
(
oid2
,
rev22
),
(
oid3
,
rev31
),
(
oid4
,
rev41
))
def
test_have_MVCC_ergo_no_ReadConflict
(
self
):
def
test_have_MVCC_ergo_no_ReadConflict
(
self
):
from
ZODB.DB
import
DB
from
ZODB.DB
import
DB
...
...
tox.ini
View file @
e83aad47
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[tox]
[tox]
minversion
=
3.18
envlist
=
envlist
=
py27,py35,py36,py37,py38,py39,pypy,pypy3
lint
py27
py35
py36
py37
py38
py39
pypy
pypy3
coverage
[testenv]
[testenv]
usedevelop
=
true
deps
=
commands
=
zope-testrunner
--test-path
=
src {posargs:-vc}
extras
=
test
[testenv:lint]
basepython
=
python3
skip_install
=
true
deps
=
flake8
check-manifest
check-python-versions
commands
=
commands
=
zope-testrunner
--test-path
=
src --auto-color --auto-progress
flake8
src
setup.py
check-manifest
check-python-versions
[testenv:coverage]
basepython
=
python3
allowlist_externals
=
mkdir
deps
=
deps
=
coverage
coverage-python-version
commands
=
mkdir
-p
{toxinidir}/parts/htmlcov
coverage
run
-m
zope.testrunner
--test-path
=
src {posargs:-vc}
coverage
html
coverage
report
-m
--fail-under
=
68
[coverage:run]
branch
=
True
plugins
=
coverage_python_version
source
=
tempstorage
[coverage:report]
precision
=
2
exclude_lines
=
pragma:
no
cover
pragma:
nocover
except
ImportError:
raise
NotImplementedError
if
__name__
=
= '__main__':
self.fail
raise
AssertionError
extras
=
test
[coverage:html]
directory
=
parts/htmlcov
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