use of com.pspace.ifs.ksan.objmanager.Metadata in project ksan by infinistor.
the class DBPerformanceTest method readFileFromDBPerformanceTest.
static void readFileFromDBPerformanceTest(ObjManager om, String name) {
int idx = 0;
String path;
String tmp = bucket + "testDir_" + name + "/test";
try {
// ObjManager om = new ObjManager();
latch.await();
initReadStartTime();
// for (idx = 0; idx < (int) numJobPerT; idx++) { //500000
while ((idx = getIndex(name + "_read")) != -1) {
path = getPath(tmp, idx);
try {
Metadata mt = om.open(bucket, path, "nil");
} catch (ResourceNotFoundException ex) {
countGetEntry();
continue;
}
countGetEntry();
}
// System.out.format("End num_entry : %d idx : %d thread : %s \n", num_entry, idx, name);
} catch (InvalidParameterException ex) {
System.out.println("Error : " + ex.getMessage());
} catch (InterruptedException ex) {
System.out.println("Thread interrupted : " + ex);
}
}
use of com.pspace.ifs.ksan.objmanager.Metadata in project ksan by infinistor.
the class DBPerformanceTest method createFileOnDBPerformanceTest.
static void createFileOnDBPerformanceTest(ObjManager om, String name) {
int idx = 0;
String path;
String tmp = bucket + "testDir_" + name + "/test";
String etag = "etag_sample";
String tag = "tag_sample";
String meta = "meta_sample";
String acl = "acl_sample";
String deleteMarker = "dmarker";
try {
// for (idx = 0; idx < (int) numJobPerT; idx++) { //500000
while ((idx = getIndex(name + "_create")) != -1) {
path = getPath(tmp, idx);
// to create on round robin osd disk
Metadata mt = om.create(bucket, path);
mt.setMeta(meta);
mt.setEtag(etag);
mt.setTag(tag);
mt.setAcl(acl);
mt.setVersionId("nil", deleteMarker, true);
om.close(bucket, path, mt);
// count++;
countEntry();
}
// System.out.format("End num_entry : %d idx : %d thread : %s \n", num_entry, idx, name);
} catch (IOException | InvalidParameterException | AllServiceOfflineException | ResourceNotFoundException ex) {
System.out.println("Error : " + ex.getMessage());
System.out.println("<><><> idx :" + idx + " thread > " + name);
}
/*catch (Exception ex) {
System.out.println(" OBJMANAGER INIT Error : " + ex.getMessage());
Logger.getLogger(DBPerformanceTest.class.getName()).log(Level.SEVERE, null, ex);
}*/
// diff = System.nanoTime() - tm;
// System.out.format(" > name : %s time : %s jobDone : %d\n", name, getInSecond(diff), count);
latch.countDown();
}
use of com.pspace.ifs.ksan.objmanager.Metadata in project ksan by infinistor.
the class CBalance method getListOfObjects.
private List<Metadata> getListOfObjects(String bucketName, String SrcDiskId, long size, long offset, String DstDiskId) {
List<Metadata> res;
List<Metadata> list;
// long offset = 0;
long numObjects = 100;
// long job_done = 0;
long size_counter = 0;
int ret;
res = new ArrayList();
ret = objm.startJob();
if (ret != 0)
return res;
do {
list = obmu.listObjects(bucketName, SrcDiskId, 1, offset, numObjects);
if (list == null)
return res;
if (list.isEmpty())
return res;
Iterator<Metadata> it = list.iterator();
while (it.hasNext()) {
totalChecked++;
Metadata mt = it.next();
if (mt.getSize() > size || mt.getSize() <= 0)
continue;
try {
if (!obmu.allowedToReplicate(bucketName, mt.getPrimaryDisk(), mt.getReplicaDisk(), DstDiskId))
continue;
} catch (ResourceNotFoundException ex) {
if (!obmu.allowedToReplicate(bucketName, mt.getPrimaryDisk(), null, DstDiskId))
continue;
}
size_counter = size_counter + mt.getSize();
res.add(mt);
if (size_counter > size)
return res;
}
offset = offset + numObjects;
} while (list.size() == numObjects);
return res;
}
use of com.pspace.ifs.ksan.objmanager.Metadata in project ksan by infinistor.
the class GetAttr method getObjects.
void getObjects() {
Metadata mt;
try {
ObjManagerUtil obmu = new ObjManagerUtil();
if (!ObjectPath.isEmpty())
mt = obmu.getObjectWithPath(bucketName, ObjectPath);
else
mt = obmu.getObject(bucketName, objId);
displayMeta(mt);
} catch (ResourceNotFoundException ex) {
displayNothing();
} catch (Exception ex) {
Logger.getLogger(GetAttr.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of com.pspace.ifs.ksan.objmanager.Metadata in project ksan by infinistor.
the class GetObjectMetadata method getObjects.
private int getObjects() {
Metadata mt1;
try {
ObjManagerUtil obmu = new ObjManagerUtil();
mt1 = obmu.getObjectWithPath(mt.getBucket(), mt.getPath());
message = mt1.toString();
return 1;
} catch (ResourceNotFoundException ex) {
message = displayNoInformation();
return 0;
} catch (Exception ex) {
message = dispalyError();
}
return -1;
}
Aggregations