use of com.pspace.ifs.ksan.gw.identity.ObjectListParameter in project ksan by infinistor.
the class Objmanagertest method testVersiong.
static void testVersiong() throws Exception {
String path;
String bucket = "testvol3vers";
String tmp = "parentD1/subDir/test";
String etag = "etag_sample";
String tag = "tag_sample";
String meta = "meta_sample";
String acl = "acl_sample";
String vers;
int ret;
ObjManager om;
om = new ObjManager();
S3ObjectList s3ObjectList = new S3ObjectList();
try {
sleep(3);
} catch (InterruptedException ex) {
Logger.getLogger(Objmanagertest.class.getName()).log(Level.SEVERE, null, ex);
}
try {
try {
om.createBucket(bucket, "legesse1", "legesse1", "acl", "", "");
} catch (ResourceAlreadyExistException ex) {
System.out.println("Bucket already exist!");
}
try {
vers = om.getBucketVersioning(bucket);
if (vers.isEmpty())
om.putBucketVersioning(bucket, "Enabled");
System.out.println("111Versioin ret :> " + vers);
} catch (ResourceNotFoundException | SQLException ex) {
try {
ret = om.putBucketVersioning(bucket, "Enabled");
System.out.println("222Versioin ret :> " + ret);
} catch (SQLException ex1) {
Logger.getLogger(Objmanagertest.class.getName()).log(Level.SEVERE, null, ex1);
}
}
long startTime = System.nanoTime();
long startTime1m = System.nanoTime();
long diff = 0;
int mcount = 1;
int idx;
Metadata mt;
for (idx = 0; idx < 200; idx++) {
path = tmp + idx;
// to create on round robin osd disk
mt = om.create(bucket, path);
om.close(bucket, path, etag, meta, tag, 0L, acl, mt.getPrimaryDisk().getPath(), mt.isReplicaExist() ? mt.getReplicaDisk().getPath() : "", Long.toString(startTime), "file");
if ((idx + 1) % 1000000 == 0) {
diff = System.nanoTime() - startTime1m;
System.out.println(mcount + ": Millon create excution time : " + diff + "nanosecond");
startTime1m = System.nanoTime();
mcount++;
}
}
diff = System.nanoTime() - startTime;
System.out.println("Total " + idx + " create excution time : " + diff + "nanosecond");
String delimiter = "/";
String startAfter = "";
int maxKeys = 10;
String prefix = "parentD1/subDir";
s3ObjectList.setMaxKeys(String.valueOf(maxKeys));
s3ObjectList.setDelimiter(delimiter);
s3ObjectList.setPrefix(prefix);
s3ObjectList.setStartAfter(startAfter);
s3ObjectList.setVersionIdMarker("");
s3ObjectList.setMarker(prefix);
try {
// om.listObjectsVersion(bucket, delimiter, startAfter, "", maxKeys, prefix);
ObjectListParameter res = om.listObjectVersions(bucket, s3ObjectList);
System.out.println("res >>" + res);
} catch (SQLException ex) {
Logger.getLogger(Objmanagertest.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (IOException | InvalidParameterException | AllServiceOfflineException | ResourceNotFoundException ex) {
System.out.println("Error : " + ex.getMessage());
// Logger.getLogger(Objmanagertest.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of com.pspace.ifs.ksan.gw.identity.ObjectListParameter in project ksan by infinistor.
the class S3Request method listObjectVersions.
protected ObjectListParameter listObjectVersions(String bucket, S3ObjectList s3ObjectList) throws GWException {
ObjectListParameter objectListParameter = null;
try {
setObjManager();
objectListParameter = objManager.listObjectVersions(bucket, s3ObjectList);
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
} finally {
try {
releaseObjManager();
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
}
}
return objectListParameter;
}
use of com.pspace.ifs.ksan.gw.identity.ObjectListParameter in project ksan by infinistor.
the class S3Request method listObjectV2.
protected ObjectListParameter listObjectV2(String bucket, S3ObjectList s3ObjectList) throws GWException {
ObjectListParameter objectListParameter = null;
try {
setObjManager();
objectListParameter = objManager.listObjectV2(bucket, s3ObjectList);
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
} finally {
try {
releaseObjManager();
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
}
}
return objectListParameter;
}
Aggregations