Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
dCache
cta
Commits
15c606e0
Commit
15c606e0
authored
6 years ago
by
Eric Cano
Browse files
Options
Downloads
Patches
Plain Diff
#433: implemented `ObjectOps<>::asyncInsert()`
parent
d4d0e710
No related branches found
Branches containing commit
Tags
v0.0-136
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
objectstore/ObjectOps.hpp
+32
-1
32 additions, 1 deletion
objectstore/ObjectOps.hpp
with
32 additions
and
1 deletion
objectstore/ObjectOps.hpp
+
32
−
1
View file @
15c606e0
...
...
@@ -460,7 +460,6 @@ public:
private
:
ObjectOps
&
m_obj
;
std
::
unique_ptr
<
Backend
::
AsyncLockfreeFetcher
>
m_asyncLockfreeFetcher
;
};
friend
AsyncLockfreeFetcher
;
...
...
@@ -471,6 +470,38 @@ public:
return
ret
.
release
();
}
class
AsyncInserter
{
friend
class
ObjectOps
;
AsyncInserter
(
ObjectOps
&
obj
)
:
m_obj
(
obj
)
{}
public
:
void
wait
()
{
m_asyncCreator
->
wait
();
m_obj
.
m_existingObject
=
true
;
}
private
:
ObjectOps
&
m_obj
;
std
::
unique_ptr
<
Backend
::
AsyncCreator
>
m_asyncCreator
;
};
friend
AsyncInserter
;
AsyncInserter
*
asyncInsert
()
{
std
::
unique_ptr
<
AsyncInserter
>
ret
;
// Current simplification: the parsing of the header/payload is synchronous.
// This could be delegated to the backend.
// Check that we are not dealing with an existing object
if
(
m_existingObject
)
throw
NotNewObject
(
"In ObjectOps::asyncInsert: trying to insert an already exitsting object"
);
// Check that the object is ready in memory
if
(
!
m_headerInterpreted
||
!
m_payloadInterpreted
)
throw
NotInitialized
(
"In ObjectOps::insert: trying to insert an uninitialized object"
);
// Push the payload into the header and write the object
// We don't require locking here, as the object does not exist
// yet in the object store (and this is ensured by the )
m_header
.
set_payload
(
m_payload
.
SerializeAsString
());
ret
->
m_asyncCreator
.
reset
(
m_objectStore
.
asyncCreate
(
getAddressIfSet
(),
m_header
.
SerializeAsString
()));
return
ret
.
release
();
}
void
commit
()
{
checkPayloadWritable
();
if
(
!
m_existingObject
)
...
...
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