Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcloudstorage
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
libcloudstorage
Commits
27ecd690
Commit
27ecd690
authored
Oct 05, 2017
by
Paweł Wegner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AmazonS3: delete uses RecursiveRequest.
parent
6d6c3148
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
30 deletions
+19
-30
AmazonS3.cpp
src/CloudProvider/AmazonS3.cpp
+19
-30
No files found.
src/CloudProvider/AmazonS3.cpp
View file @
27ecd690
...
...
@@ -28,6 +28,7 @@
#include <algorithm>
#include <iomanip>
#include "Request/RecursiveRequest.h"
#include "Utility/Utility.h"
using
namespace
std
::
placeholders
;
...
...
@@ -285,36 +286,24 @@ IItem::Pointer AmazonS3::createDirectoryResponse(const IItem& parent,
ICloudProvider
::
DeleteItemRequest
::
Pointer
AmazonS3
::
deleteItemAsync
(
IItem
::
Pointer
item
,
DeleteItemCallback
callback
)
{
return
std
::
make_shared
<
Request
<
EitherError
<
void
>>>
(
shared_from_this
(),
callback
,
[
=
](
Request
<
EitherError
<
void
>>::
Pointer
r
)
{
auto
release
=
[
=
]
{
r
->
request
(
[
=
](
util
::
Output
)
{
auto
data
=
extract
(
item
->
id
());
return
http
()
->
create
(
"https://"
+
data
.
first
+
".s3."
+
region
()
+
".amazonaws.com/"
+
escapePath
(
data
.
second
),
"DELETE"
);
},
[
=
](
EitherError
<
Response
>
e
)
{
r
->
done
(
e
.
left
()
?
e
.
left
()
:
nullptr
);
});
};
if
(
item
->
type
()
==
IItem
::
FileType
::
Directory
)
{
r
->
subrequest
(
r
->
provider
()
->
listDirectoryAsync
(
item
,
[
=
](
EitherError
<
std
::
vector
<
IItem
::
Pointer
>>
e
)
{
if
(
e
.
left
())
return
r
->
done
(
e
.
left
());
remove
<
EitherError
<
void
>>
(
r
,
e
.
right
(),
[
=
](
EitherError
<
void
>
e
)
{
if
(
e
.
left
())
return
r
->
done
(
e
.
left
());
release
();
});
}));
}
else
release
();
})
using
Request
=
RecursiveRequest
<
EitherError
<
void
>>
;
auto
visitor
=
[
=
](
Request
::
Pointer
r
,
IItem
::
Pointer
item
,
Request
::
CompleteCallback
complete
)
{
auto
id
=
extract
(
item
->
id
());
r
->
request
(
[
=
](
util
::
Output
)
{
return
http
()
->
create
(
"https://"
+
id
.
first
+
".s3."
+
region
()
+
".amazonaws.com/"
+
escapePath
(
id
.
second
),
"DELETE"
);
},
[
=
](
EitherError
<
Response
>
e
)
{
if
(
e
.
left
())
complete
(
e
.
left
());
else
complete
(
nullptr
);
});
};
return
std
::
make_shared
<
Request
>
(
shared_from_this
(),
item
,
callback
,
visitor
)
->
run
();
}
...
...
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