Search in sources :

Example 16 with Metadata

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);
    }
}
Also used : InvalidParameterException(java.security.InvalidParameterException) Metadata(com.pspace.ifs.ksan.objmanager.Metadata) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)

Example 17 with Metadata

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();
}
Also used : InvalidParameterException(java.security.InvalidParameterException) AllServiceOfflineException(com.pspace.ifs.ksan.objmanager.ObjManagerException.AllServiceOfflineException) Metadata(com.pspace.ifs.ksan.objmanager.Metadata) IOException(java.io.IOException) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)

Example 18 with Metadata

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;
}
Also used : Metadata(com.pspace.ifs.ksan.objmanager.Metadata) ArrayList(java.util.ArrayList) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)

Example 19 with Metadata

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);
    }
}
Also used : ObjManagerUtil(com.pspace.ifs.ksan.objmanager.ObjManagerUtil) Metadata(com.pspace.ifs.ksan.objmanager.Metadata) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException) CmdLineException(org.kohsuke.args4j.CmdLineException) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)

Example 20 with Metadata

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;
}
Also used : ObjManagerUtil(com.pspace.ifs.ksan.objmanager.ObjManagerUtil) Metadata(com.pspace.ifs.ksan.objmanager.Metadata) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)

Aggregations

Metadata (com.pspace.ifs.ksan.objmanager.Metadata)31 GWException (com.pspace.ifs.ksan.gw.exception.GWException)23 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)17 S3Bucket (com.pspace.ifs.ksan.gw.identity.S3Bucket)17 S3Metadata (com.pspace.ifs.ksan.gw.identity.S3Metadata)13 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)12 ResourceNotFoundException (com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)12 XMLStreamException (javax.xml.stream.XMLStreamException)12 IOException (java.io.IOException)11 S3ObjectOperation (com.pspace.ifs.ksan.gw.object.S3ObjectOperation)10 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)6 S3Object (com.pspace.ifs.ksan.gw.object.S3Object)6 XMLOutputFactory (javax.xml.stream.XMLOutputFactory)6 ResourceAlreadyExistException (com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceAlreadyExistException)5 ObjMultipart (com.pspace.ifs.ksan.objmanager.ObjMultipart)5 XmlMapper (com.fasterxml.jackson.dataformat.xml.XmlMapper)4 AccessControlPolicy (com.pspace.ifs.ksan.gw.format.AccessControlPolicy)4 AccessControlList (com.pspace.ifs.ksan.gw.format.AccessControlPolicy.AccessControlList)4 Grant (com.pspace.ifs.ksan.gw.format.AccessControlPolicy.AccessControlList.Grant)4 Owner (com.pspace.ifs.ksan.gw.format.AccessControlPolicy.Owner)4