Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YCSB
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Adnan Ahmad
YCSB
Commits
f84956ae
Commit
f84956ae
authored
9 years ago
by
Sean Busbey
Browse files
Options
Downloads
Patches
Plain Diff
[s3] updates to compile.
- version number fix - DB methods return Status objects.
parent
ff25df0f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
s3/pom.xml
+1
-1
1 addition, 1 deletion
s3/pom.xml
s3/src/main/java/com/yahoo/ycsb/db/S3Client.java
+24
-25
24 additions, 25 deletions
s3/src/main/java/com/yahoo/ycsb/db/S3Client.java
with
25 additions
and
26 deletions
s3/pom.xml
+
1
−
1
View file @
f84956ae
...
...
@@ -19,7 +19,7 @@ LICENSE file.
<parent>
<groupId>
com.yahoo.ycsb
</groupId>
<artifactId>
binding-parent
</artifactId>
<version>
0.
5
.0-SNAPSHOT
</version>
<version>
0.
6
.0-SNAPSHOT
</version>
<relativePath>
../binding-parent
</relativePath>
</parent>
...
...
This diff is collapsed.
Click to expand it.
s3/src/main/java/com/yahoo/ycsb/db/S3Client.java
+
24
−
25
View file @
f84956ae
...
...
@@ -32,6 +32,7 @@ import com.yahoo.ycsb.ByteArrayByteIterator;
import
com.yahoo.ycsb.ByteIterator
;
import
com.yahoo.ycsb.DB
;
import
com.yahoo.ycsb.DBException
;
import
com.yahoo.ycsb.Status
;
import
com.amazonaws.services.s3.AmazonS3Client
;
import
com.amazonaws.services.s3.*
;
...
...
@@ -105,19 +106,19 @@ public class S3Client extends DB {
* The name of the bucket
* @param key
* The record key of the file to delete.
* @return
Zero
on success,
a non-zero error code on error
. See the
* @return
OK
on success,
otherwise ERROR
. See the
* {@link DB} class's description for a discussion of error codes.
*/
@Override
public
int
delete
(
String
bucket
,
String
key
)
{
public
Status
delete
(
String
bucket
,
String
key
)
{
try
{
s3Client
.
deleteObject
(
new
DeleteObjectRequest
(
bucket
,
key
));
}
catch
(
Exception
e
){
System
.
err
.
println
(
"Not possible to delete the key "
+
key
);
e
.
printStackTrace
();
return
1
;
return
Status
.
ERROR
;
}
return
0
;
return
Status
.
OK
;
}
/**
* Initialize any state for the storage.
...
...
@@ -252,11 +253,11 @@ public class S3Client extends DB {
* multiplied by the number of field. In this way the size
* of the file to upload is determined by the fieldlength
* and fieldcount parameters.
* @return
Zero
on success,
a non-zero error code on error
. See the
* @return
OK
on success,
ERROR otherwise
. See the
* {@link DB} class's description for a discussion of error codes.
*/
@Override
public
int
insert
(
String
bucket
,
String
key
,
public
Status
insert
(
String
bucket
,
String
key
,
HashMap
<
String
,
ByteIterator
>
values
)
{
return
writeToStorage
(
bucket
,
key
,
values
,
true
,
sse
,
ssecKey
);
}
...
...
@@ -273,10 +274,10 @@ public class S3Client extends DB {
* it is null by default
* @param result
* A HashMap of field/value pairs for the result
* @return
Zero
on success,
a non-zero error code on error or "not found"
.
* @return
OK
on success,
ERROR otherwise
.
*/
@Override
public
int
read
(
String
bucket
,
String
key
,
Set
<
String
>
fields
,
public
Status
read
(
String
bucket
,
String
key
,
Set
<
String
>
fields
,
HashMap
<
String
,
ByteIterator
>
result
)
{
return
readFromStorage
(
bucket
,
key
,
result
,
ssecKey
);
}
...
...
@@ -291,11 +292,10 @@ public class S3Client extends DB {
* The file key of the file to write.
* @param values
* A HashMap of field/value pairs to update in the record
* @return Zero on success, a non-zero error code on error. See this class's
* description for a discussion of error codes.
* @return OK on success, ERORR otherwise.
*/
@Override
public
int
update
(
String
bucket
,
String
key
,
public
Status
update
(
String
bucket
,
String
key
,
HashMap
<
String
,
ByteIterator
>
values
)
{
return
writeToStorage
(
bucket
,
key
,
values
,
false
,
sse
,
ssecKey
);
}
...
...
@@ -314,11 +314,10 @@ public class S3Client extends DB {
* @param result
* A Vector of HashMaps, where each HashMap is a set field/value
* pairs for one file
* @return Zero on success, a non-zero error code on error. See the
* {@link DB} class's description for a discussion of error codes.
* @return OK on success, ERROR otherwise.
*/
@Override
public
int
scan
(
String
bucket
,
String
startkey
,
int
recordcount
,
public
Status
scan
(
String
bucket
,
String
startkey
,
int
recordcount
,
Set
<
String
>
fields
,
Vector
<
HashMap
<
String
,
ByteIterator
>>
result
)
{
return
scanFromStorage
(
bucket
,
startkey
,
recordcount
,
result
,
ssecKey
);
}
...
...
@@ -336,7 +335,7 @@ public class S3Client extends DB {
* to S3. If false an existing object will be re-uploaded
*
*/
protected
int
writeToStorage
(
String
bucket
,
String
key
,
protected
Status
writeToStorage
(
String
bucket
,
String
key
,
HashMap
<
String
,
ByteIterator
>
values
,
Boolean
updateMarker
,
String
sseLocal
,
SSECustomerKey
ssecLocal
)
{
int
totalSize
=
0
;
...
...
@@ -372,7 +371,7 @@ public class S3Client extends DB {
}
catch
(
Exception
e
){
System
.
err
.
println
(
"Not possible to get the object :"
+
key
);
e
.
printStackTrace
();
return
1
;
return
Status
.
ERROR
;
}
}
byte
[]
destinationArray
=
new
byte
[
totalSize
];
...
...
@@ -401,7 +400,7 @@ public class S3Client extends DB {
PutObjectResult
res
=
s3Client
.
putObject
(
putObjectRequest
);
if
(
res
.
getETag
()
==
null
)
{
return
1
;
return
Status
.
ERROR
;
}
else
{
if
(
sseLocal
.
equals
(
"true"
))
{
System
.
out
.
println
(
"Uploaded object encryption status is "
+
...
...
@@ -414,14 +413,14 @@ public class S3Client extends DB {
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"Not possible to write object :"
+
key
);
e
.
printStackTrace
();
return
1
;
return
Status
.
ERROR
;
}
finally
{
return
0
;
return
Status
.
OK
;
}
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"Error in the creation of the stream :"
+
e
.
toString
());
e
.
printStackTrace
();
return
1
;
return
Status
.
ERROR
;
}
}
...
...
@@ -436,7 +435,7 @@ public class S3Client extends DB {
* The Hash map where data from the object are written
*
*/
protected
int
readFromStorage
(
String
bucket
,
String
key
,
protected
Status
readFromStorage
(
String
bucket
,
String
key
,
HashMap
<
String
,
ByteIterator
>
result
,
SSECustomerKey
ssecLocal
)
{
try
{
GetObjectRequest
getObjectRequest
=
null
;
...
...
@@ -465,9 +464,9 @@ public class S3Client extends DB {
}
catch
(
Exception
e
){
System
.
err
.
println
(
"Not possible to get the object "
+
key
);
e
.
printStackTrace
();
return
1
;
return
Status
.
ERROR
;
}
finally
{
return
0
;
return
Status
.
OK
;
}
}
...
...
@@ -487,7 +486,7 @@ public class S3Client extends DB {
* pairs for one file
*
*/
protected
int
scanFromStorage
(
String
bucket
,
String
startkey
,
protected
Status
scanFromStorage
(
String
bucket
,
String
startkey
,
int
recordcount
,
Vector
<
HashMap
<
String
,
ByteIterator
>>
result
,
SSECustomerKey
ssecLocal
)
{
...
...
@@ -532,6 +531,6 @@ public class S3Client extends DB {
ssecLocal
);
result
.
add
(
resultTemp
);
}
return
0
;
return
Status
.
OK
;
}
}
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