Пример #1
0
 public Key importFile(int i, Futures fs) {
   if (_ok[i] < H2O.CLOUD.size()) return null;
   File f = new File(_files[i]);
   Key k;
   if (_newApi) {
     k = PersistNFS.decodeFile(f);
     NFSFileVec nfs = DKV.get(NFSFileVec.make(f, fs)).get();
     UKV.put(k, new Frame(new String[] {"0"}, new Vec[] {nfs}), fs);
   } else {
     k = PersistNFS.decodeFile(f);
     long size = f.length();
     Value val =
         (size < 2 * ValueArray.CHUNK_SZ)
             ? new Value(k, (int) size, Value.NFS)
             : new Value(k, new ValueArray(k, size), Value.NFS);
     val.setdsk();
     UKV.put(k, val, fs);
   }
   return k;
 }
Пример #2
0
 // Make a new NFSFileVec key which holds the filename implicitly.
 // This name is used by the DVecs to load data on-demand.
 public static Key make(File f) {
   long size = f.length();
   Key k1 = PersistNFS.decodeFile(f);
   byte[] bits = new byte[1 + 1 + 4 + k1._kb.length];
   bits[0] = Key.VEC;
   bits[1] = 0; // Not homed
   UDP.set4(bits, 2, -1); // 0xFFFFFFFF in the chunk# area
   System.arraycopy(k1._kb, 0, bits, 1 + 1 + 4, k1._kb.length);
   Key k = Key.make(bits);
   // Insert the top-level FileVec key into the store
   DKV.put(k, new NFSFileVec(k, size));
   return k;
 }