Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.libnetworkcache
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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
slapos.libnetworkcache
Commits
1130d381
Commit
1130d381
authored
Mar 08, 2022
by
Julien Muchembled
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New tryDownload/tryUpload methods
parent
330e4eee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
slapos/libnetworkcache.py
slapos/libnetworkcache.py
+19
-0
No files found.
slapos/libnetworkcache.py
View file @
1130d381
...
...
@@ -286,6 +286,25 @@ class NetworkcacheClient(object):
connection
.
close
()
raise
HTTPError
(
url
,
r
.
status
,
r
.
reason
,
r
.
msg
,
r
.
fp
)
def
tryDownload
(
self
,
key
):
"""
To be called before attemting to download from network cache.
bool(returned value) is True if that possible (i.e. configured),
- in which case the method logs what's going to happen;
- else the caller should continue without network cache.
"""
config_get
=
self
.
config
.
get
if
config_get
(
'download-dir-url'
)
and
config_get
(
'download-cache-url'
):
logger
.
info
(
'Trying to download %s from network cache...'
,
key
)
return
True
def
tryUpload
(
self
,
key
):
"""Similar to tryDownload but for upload"""
config_get
=
self
.
config
.
get
if
config_get
(
'upload-dir-url'
)
and
config_get
(
'upload-cache-url'
):
logger
.
info
(
'Trying to upload %s to network cache...'
,
key
)
return
True
@
staticmethod
def
archive
(
path
):
# Don't create it to /tmp dir as it can be too small.
...
...
Julien Muchembled
@jm
mentioned in merge request
slapos.buildout!26 (merged)
·
Mar 09, 2022
mentioned in merge request
slapos.buildout!26 (merged)
mentioned in merge request slapos.buildout!26
Toggle commit list
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