Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CVMFS monitor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cernvm
CVMFS monitor
Commits
91378e65
Commit
91378e65
authored
4 years ago
by
Jakob Blomer
Browse files
Options
Downloads
Patches
Plain Diff
add revision to file attributes in the browser
parent
4d295d6f
No related branches found
No related tags found
1 merge request
!12
add revision to file attributes in the browser
Pipeline
#2144192
passed
4 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
backend/libcvmfs_node.cc
+14
-10
14 additions, 10 deletions
backend/libcvmfs_node.cc
with
14 additions
and
10 deletions
backend/libcvmfs_node.cc
+
14
−
10
View file @
91378e65
...
...
@@ -13,9 +13,10 @@ cvmfs_option_map *g_opts;
cvmfs_context
*
g_ctx
;
struct
AttachedRepository
{
cvmfs_context
*
ctx
;
cvmfs_context
*
ctx
=
nullptr
;
// When to check next time for remount
time_t
timeout_deadline
;
time_t
timeout_deadline
=
0
;
uint64_t
revision
=
0
;
};
std
::
map
<
std
::
string
,
AttachedRepository
>
g_attached_repos
;
...
...
@@ -37,13 +38,15 @@ bool AttachRepo(const std::string &repo, Napi::Env env) {
AttachedRepository
ar
;
ar
.
ctx
=
context
;
ar
.
timeout_deadline
=
time
(
NULL
)
+
kDefaultTimeout
;
ar
.
revision
=
cvmfs_get_revision
(
context
);
g_attached_repos
[
repo
]
=
ar
;
return
true
;
}
cvmfs_context
*
GetRepo
Ctx
(
const
std
::
string
repo
,
Napi
::
Env
env
)
{
AttachedRepository
GetRepo
(
const
std
::
string
repo
,
Napi
::
Env
env
)
{
if
(
g_attached_repos
.
count
(
repo
)
==
0
)
{
if
(
!
AttachRepo
(
repo
,
env
))
return
NULL
;
if
(
!
AttachRepo
(
repo
,
env
))
return
AttachedRepository
();
}
if
(
time
(
NULL
)
>
g_attached_repos
[
repo
].
timeout_deadline
)
{
printf
(
"[INF]: remounting %s due to timeout
\n
"
,
repo
.
c_str
());
...
...
@@ -56,7 +59,7 @@ cvmfs_context *GetRepoCtx(const std::string repo, Napi::Env env) {
g_attached_repos
[
repo
].
timeout_deadline
=
time
(
NULL
)
+
kDefaultTimeout
;
}
}
return
g_attached_repos
[
repo
]
.
ctx
;
return
g_attached_repos
[
repo
];
}
void
FillStat
(
cvmfs_stat_t
*
st
,
Napi
::
Object
*
obj
)
{
...
...
@@ -139,7 +142,8 @@ Napi::Value Stat(const Napi::CallbackInfo &info) {
std
::
string
repo
=
info
[
0
].
As
<
Napi
::
String
>
();
std
::
string
path
=
info
[
1
].
As
<
Napi
::
String
>
();
cvmfs_context
*
ctx
=
GetRepoCtx
(
repo
,
env
);
AttachedRepository
attached_repository
=
GetRepo
(
repo
,
env
);
cvmfs_context
*
ctx
=
attached_repository
.
ctx
;
if
(
ctx
==
NULL
)
{
return
env
.
Null
();
}
...
...
@@ -154,7 +158,7 @@ Napi::Value Stat(const Napi::CallbackInfo &info) {
}
FillAttr
(
attr
,
&
result
);
result
.
Set
(
"revision"
,
attached_repository
.
revision
);
cvmfs_attr_free
(
attr
);
if
(
S_ISDIR
(
attr
->
st_mode
))
{
...
...
@@ -231,7 +235,7 @@ Napi::Value Open(const Napi::CallbackInfo &info) {
std
::
string
repo
=
info
[
0
].
As
<
Napi
::
String
>
();
std
::
string
path
=
info
[
1
].
As
<
Napi
::
String
>
();
cvmfs_context
*
ctx
=
GetRepo
Ctx
(
repo
,
env
);
cvmfs_context
*
ctx
=
GetRepo
(
repo
,
env
)
.
ctx
;
if
(
ctx
==
NULL
)
{
return
env
.
Null
();
}
...
...
@@ -259,7 +263,7 @@ Napi::Value Pread(const Napi::CallbackInfo &info) {
int64_t
size
=
info
[
2
].
As
<
Napi
::
Number
>
();
int64_t
offset
=
info
[
3
].
As
<
Napi
::
Number
>
();
cvmfs_context
*
ctx
=
GetRepo
Ctx
(
repo
,
env
);
cvmfs_context
*
ctx
=
GetRepo
(
repo
,
env
)
.
ctx
;
if
(
ctx
==
NULL
)
{
return
env
.
Null
();
}
...
...
@@ -290,7 +294,7 @@ Napi::Value Close(const Napi::CallbackInfo &info) {
std
::
string
repo
=
info
[
0
].
As
<
Napi
::
String
>
();
int
fd
=
info
[
1
].
As
<
Napi
::
Number
>
();
cvmfs_context
*
ctx
=
GetRepo
Ctx
(
repo
,
env
);
cvmfs_context
*
ctx
=
GetRepo
(
repo
,
env
)
.
ctx
;
if
(
!
ctx
)
{
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment