Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-datastore
Commits
52b69de8
Commit
52b69de8
authored
Oct 17, 2017
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add locks to maintenance methods is syncds
parent
73c601d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
sync/sync.go
sync/sync.go
+6
-0
No files found.
sync/sync.go
View file @
52b69de8
...
...
@@ -117,6 +117,8 @@ func (b *syncBatch) Commit() error {
func
(
d
*
MutexDatastore
)
Check
()
error
{
if
c
,
ok
:=
d
.
child
.
(
ds
.
CheckedDatastore
);
ok
{
d
.
RWMutex
.
Lock
()
defer
d
.
RWMutex
.
Unlock
()
return
c
.
Check
()
}
return
nil
...
...
@@ -124,6 +126,8 @@ func (d *MutexDatastore) Check() error {
func
(
d
*
MutexDatastore
)
Scrub
()
error
{
if
c
,
ok
:=
d
.
child
.
(
ds
.
ScrubbedDatastore
);
ok
{
d
.
RWMutex
.
Lock
()
defer
d
.
RWMutex
.
Unlock
()
return
c
.
Scrub
()
}
return
nil
...
...
@@ -131,6 +135,8 @@ func (d *MutexDatastore) Scrub() error {
func
(
d
*
MutexDatastore
)
CollectGarbage
()
error
{
if
c
,
ok
:=
d
.
child
.
(
ds
.
GCDatastore
);
ok
{
d
.
RWMutex
.
Lock
()
defer
d
.
RWMutex
.
Unlock
()
return
c
.
CollectGarbage
()
}
return
nil
...
...
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