Examples of PaasConnection


Examples of com.netflix.staash.connection.PaasConnection

        this.fac = fac;
    }

    public String writeRow(String db, String table, JsonObject rowObj) {
        JsonObject storageConf = meta.getStorageForTable(db+"."+table);
        PaasConnection conn = fac.createConnection(storageConf, db);
        return conn.insert(db,table,rowObj);
    }
View Full Code Here

Examples of com.netflix.staash.connection.PaasConnection

        PaasConnection conn = fac.createConnection(storageConf, db);
        return conn.insert(db,table,rowObj);
    }
    public String writeToKVStore(String db, String table, JsonObject rowObj) {
      JsonObject storageConf = meta.getStorageForTable(db+"."+table);
        PaasConnection conn = fac.createConnection(storageConf, db);
        rowObj.putString("type", "kv");
    return conn.insert(db, table, rowObj);
    }
View Full Code Here

Examples of com.netflix.staash.connection.PaasConnection

    }

    public String listRow(String db, String table, String keycol, String key) {
        JsonObject storageConf = meta.getStorageForTable(db+"."+table);
        if (storageConf == null) return "{\"msg\":\"the requested table does not exist in paas\"}";
        PaasConnection conn = fac.createConnection(storageConf,db);
        return conn.read(db,table,keycol,key);
    }
View Full Code Here

Examples of com.netflix.staash.connection.PaasConnection

    public String writeEvent(String db, String table, JsonObject rowObj) {
        JsonObject tbl = meta.runQuery(EntityType.SERIES, db+"."+table);
        if (tbl == null) throw new RuntimeException("Table "+table+" does not exist");
        JsonObject storageConf = meta.getStorageForTable(db+"."+table);
        if (storageConf == null) throw new RuntimeException("Storage for  "+table+" does not exist");
        PaasConnection conn = fac.createConnection(storageConf,db);
        String periodicity = tbl.getString("periodicity");
        Long time = rowObj.getLong("timestamp");
        if (time == null || time <= 0) {
          time = System.currentTimeMillis();
        }
        String prefix = rowObj.getString("prefix");
        if (prefix !=  null && !prefix.equals("")) prefix = prefix+":"; else prefix = "";
        Long rowkey = (time/Long.parseLong(periodicity))*Long.parseLong(periodicity);
        rowObj.putString("columns", "key,column1,value");
        rowObj.putString("values","'"+prefix+String.valueOf(rowkey)+"',"+time+",'"+rowObj.getString("event")+"'");
        return conn.insert(db,table,rowObj);
    }
View Full Code Here

Examples of com.netflix.staash.connection.PaasConnection

    public String readEvent(String db, String table, String eventTime) {
        JsonObject tbl = meta.runQuery(EntityType.SERIES, db+"."+table);
        if (tbl == null) throw new RuntimeException("Table "+table+" does not exist");
        JsonObject storageConf = meta.getStorageForTable(db+"."+table);
        if (storageConf == null) throw new RuntimeException("Storage for  "+table+" does not exist");
        PaasConnection conn = fac.createConnection(storageConf,db);
        String periodicity = tbl.getString("periodicity");
        Long time = Long.parseLong(eventTime);
        Long rowkey = (time/Long.parseLong(periodicity))*Long.parseLong(periodicity);
        return conn.read(db,table,"key",String.valueOf(rowkey),"column1",String.valueOf(eventTime));
    }
View Full Code Here

Examples of com.netflix.staash.connection.PaasConnection

    public String readEvent(String db, String table, String prefix,String eventTime) {
        JsonObject tbl = meta.runQuery(EntityType.SERIES, db+"."+table);
        if (tbl == null) throw new RuntimeException("Table "+table+" does not exist");
        JsonObject storageConf = meta.getStorageForTable(db+"."+table);
        if (storageConf == null) throw new RuntimeException("Storage for  "+table+" does not exist");
        PaasConnection conn = fac.createConnection(storageConf,db);
        String periodicity = tbl.getString("periodicity");
        Long time = Long.parseLong(eventTime);
        Long rowkey = (time/Long.parseLong(periodicity))*Long.parseLong(periodicity);
        if (prefix !=  null && !prefix.equals("")) prefix = prefix+":"; else prefix = "";
        return conn.read(db,table,"key",prefix+String.valueOf(rowkey),"column1",String.valueOf(eventTime));
    }
View Full Code Here

Examples of com.netflix.staash.connection.PaasConnection

    public String readEvent(String db, String table, String prefix,String startTime, String endTime) {
        JsonObject tbl = meta.runQuery(EntityType.SERIES, db+"."+table);
        if (tbl == null) throw new RuntimeException("Table "+table+" does not exist");
        JsonObject storageConf = meta.getStorageForTable(db+"."+table);
        if (storageConf == null) throw new RuntimeException("Storage for  "+table+" does not exist");
        PaasConnection conn = fac.createConnection(storageConf,db);
        String periodicity = tbl.getString("periodicity");
        Long time = Long.parseLong(startTime);
        Long startTimekey = (time/Long.parseLong(periodicity))*Long.parseLong(periodicity);
        Long endTimeL = Long.parseLong(endTime);
        Long endTimeKey = (endTimeL/Long.parseLong(periodicity))*Long.parseLong(periodicity);
        if (prefix !=  null && !prefix.equals("")) prefix = prefix+":"; else prefix = "";
        JsonObject response = new JsonObject();
        for (Long current = startTimekey; current < endTimeKey;current = current+Long.parseLong(periodicity) ) {
            JsonObject  slice = new JsonObject(conn.read(db,table,"key",prefix+String.valueOf(current)));
          for (String field:slice.getFieldNames()) {
            response.putString(field, slice.getString(field));
          }
        }
        return response.toString();
View Full Code Here

Examples of com.netflix.staash.connection.PaasConnection

  public byte[] fetchValueForKey(String db, String table, String keycol,
      String key) {
    JsonObject storageConf = meta.getStorageForTable(db+"."+table);
        if (storageConf == null) return "{\"msg\":\"the requested table does not exist in paas\"}".getBytes();
        PaasConnection conn = fac.createConnection(storageConf,db);
        String ret = conn.read(db,table,keycol,key);
        JsonObject keyval = new JsonObject(ret).getObject("1");
        String val = keyval.getString("value");
        return val.getBytes();
  }
View Full Code Here

Examples of com.netflix.staash.connection.PaasConnection

  }

  public byte[] readChunked(String db, String table, String objectName) {
    JsonObject storageConf = meta.getStorageForTable(db+"."+table);
        if (storageConf == null) return "{\"msg\":\"the requested table does not exist in paas\"}".getBytes();
        PaasConnection conn = fac.createConnection(storageConf,db);
        ByteArrayOutputStream os =  conn.readChunked(db, table, objectName);
        return os.toByteArray();
 
View Full Code Here

Examples of com.netflix.staash.connection.PaasConnection

  public String writeChunked(String db, String table, String objectName,
      InputStream is) {
    // TODO Auto-generated method stub
    JsonObject storageConf = meta.getStorageForTable(db+"."+table);
        if (storageConf == null) return "{\"msg\":\"the requested table does not exist in paas\"}";
        PaasConnection conn = fac.createConnection(storageConf,db);
        return conn.writeChunked(db, table, objectName, is);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.