Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
b001ff89
Commit
b001ff89
authored
Jan 29, 2014
by
Sofia Papagiannaki
Committed by
Christos Stavrakakis
Mar 31, 2014
Browse files
pithos: Evaluate "available" during object metadata access
parent
9807ff1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py
View file @
b001ff89
...
...
@@ -786,7 +786,7 @@ class Node(DBWorker):
def
version_create
(
self
,
node
,
hash
,
size
,
type
,
source
,
muser
,
uuid
,
checksum
,
cluster
=
0
,
update_statistics_ancestors_depth
=
None
,
available
=
True
):
available
=
True
,
map_check_timestamp
=
None
):
"""Create a new version from the given properties.
Return the (serial, mtime) of the new version.
"""
...
...
@@ -795,7 +795,8 @@ class Node(DBWorker):
s
=
self
.
versions
.
insert
().
values
(
node
=
node
,
hash
=
hash
,
size
=
size
,
type
=
type
,
source
=
source
,
mtime
=
mtime
,
muser
=
muser
,
uuid
=
uuid
,
checksum
=
checksum
,
cluster
=
cluster
,
available
=
available
)
cluster
=
cluster
,
available
=
available
,
map_check_timestamp
=
map_check_timestamp
)
serial
=
self
.
conn
.
execute
(
s
).
inserted_primary_key
[
0
]
self
.
statistics_update_ancestors
(
node
,
1
,
size
,
mtime
,
cluster
,
update_statistics_ancestors_depth
)
...
...
snf-pithos-backend/pithos/backends/modular.py
View file @
b001ff89
...
...
@@ -967,6 +967,14 @@ class ModularBackend(BaseBackend):
path
,
node
=
self
.
_lookup_object
(
account
,
container
,
name
)
props
=
self
.
_get_version
(
node
,
version
)
if
version
is
None
:
if
not
props
[
self
.
AVAILABLE
]:
try
:
self
.
_update_available
(
props
)
except
(
NotAllowedError
,
IllegalOperationError
):
pass
# just update the database
finally
:
# get updated properties
props
=
self
.
_get_version
(
node
,
version
)
modified
=
props
[
self
.
MTIME
]
else
:
try
:
...
...
@@ -1188,7 +1196,8 @@ class ModularBackend(BaseBackend):
pre_version_id
,
dest_version_id
=
self
.
_put_version_duplicate
(
user
,
node
,
src_node
=
src_node
,
size
=
size
,
type
=
type
,
hash
=
hash
,
checksum
=
checksum
,
is_copy
=
is_copy
,
update_statistics_ancestors_depth
=
1
,
available
=
available
)
update_statistics_ancestors_depth
=
1
,
available
=
available
,
keep_available
=
False
)
# Handle meta.
if
src_version_id
is
None
:
...
...
@@ -1740,7 +1749,7 @@ class ModularBackend(BaseBackend):
type
=
None
,
hash
=
None
,
checksum
=
None
,
cluster
=
CLUSTER_NORMAL
,
is_copy
=
False
,
update_statistics_ancestors_depth
=
None
,
available
=
True
):
available
=
True
,
keep_
available
=
True
):
"""Create a new version of the node."""
props
=
self
.
node
.
version_lookup
(
...
...
@@ -1751,12 +1760,20 @@ class ModularBackend(BaseBackend):
src_size
=
props
[
self
.
SIZE
]
src_type
=
props
[
self
.
TYPE
]
src_checksum
=
props
[
self
.
CHECKSUM
]
if
keep_available
:
src_available
=
props
[
self
.
AVAILABLE
]
src_map_check_timestamp
=
props
[
self
.
MAP_CHECK_TIMESTAMP
]
else
:
src_available
=
available
src_map_check_timestamp
=
None
else
:
src_version_id
=
None
src_hash
=
None
src_size
=
0
src_type
=
''
src_checksum
=
''
src_available
=
available
src_map_check_timestamp
=
None
if
size
is
None
:
# Set metadata.
hash
=
src_hash
# This way hash can be set to None
# (account or container).
...
...
@@ -1782,7 +1799,8 @@ class ModularBackend(BaseBackend):
dest_version_id
,
mtime
=
self
.
node
.
version_create
(
node
,
hash
,
size
,
type
,
src_version_id
,
user
,
uuid
,
checksum
,
cluster
,
update_statistics_ancestors_depth
,
available
=
available
)
available
=
src_available
,
map_check_timestamp
=
src_map_check_timestamp
)
self
.
node
.
attribute_unset_is_latest
(
node
,
dest_version_id
)
...
...
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