Examples of RevValue


Examples of com.google.nigori.common.RevValue

          datastore.prepare(getRevisionValues).asList(FetchOptions.Builder.withDefaults());
      for (Entity result : results) {
        ByteArrayInputStream bais =
            new ByteArrayInputStream(((Blob) result.getProperty("revision")).getBytes());
        ObjectInputStream ndis = new ObjectInputStream(bais);
        answer.add(new RevValue(((Revision) ndis.readObject()).getBytes(),
            ((Blob) result.getProperty("value")).getBytes()));
      }
      if (lookup != null) {
        return answer;
      } else {
View Full Code Here

Examples of com.google.nigori.common.RevValue

    try {
      Key lookupKey = getLookupKey(user, index);
      Key revisionKey = AppEngineRecord.makeKey(lookupKey, new BytesRevision(revision));
      // If this doesn't exist there is no key so null gets returned by JDOObjectNotFoundException
      AppEngineRecord record = pm.getObjectById(AppEngineRecord.class, revisionKey);
      return new RevValue(revision, record.getValue());
    } catch (JDOObjectNotFoundException e) {
      return null;
    } finally {
      pm.close();
    }
View Full Code Here

Examples of com.google.nigori.common.RevValue

        for (; OperationStatus.SUCCESS == status; status =
            cursor.getNextDup(lookupKey, revision, null)) {
          revisionKey = makeValueKey(lookup, revision.getData());
          OperationStatus valStatus = db.get(txn, revisionKey, value, null);
          if (OperationStatus.SUCCESS == valStatus) {
            collection.add(new RevValue(revision.getData(), value.getData()));
          } else {
            // TODO(drt24) revision exists but value does not.
          }
        }
      } finally {
View Full Code Here

Examples of com.google.nigori.common.RevValue

  public RevValue getRevision(User user, byte[] key, byte[] revision) throws IOException {
    try {
      DatabaseEntry value = new DatabaseEntry();
      OperationStatus status = db.get(null, makeValueKey(makeLookupBytes(user, key), revision), value, null);
      if (OperationStatus.SUCCESS == status) {
        return new RevValue(revision, value.getData());
      }
      return null;
    } catch (DatabaseException e) {
      throw new IOException(e);
    }
View Full Code Here

Examples of com.google.nigori.common.RevValue

    for (Node<Revision> rev : heads) {
      Revision revision = rev.getValue();
      byte[] value = getRevision(index, revision);
      // TODO(drt24) value might be null
      if (value != null) {
        answer.add(new RevValue(revision, value));
      }
    }
    return answer;
  }
View Full Code Here

Examples of com.google.nigori.common.RevValue

  @Override
  public RevValue put(Index index, byte[] value, RevValue... parents) throws IOException,
      NigoriCryptographyException, UnauthorisedException {
    byte[] revBytes = generateHash(value, toIDByte(parents));
    Revision rev = new Revision(revBytes);
    RevValue rv = new RevValue(rev, value);
    boolean success = store.put(index, rev, value);
    if (!success) {
      throw new IOException("Could not put into the store");
    }
    return rv;
View Full Code Here

Examples of com.google.nigori.common.RevValue

    for (T item : equivalence) {
      value = item;
      values.add(mapBack.get(item));
    }
    T item = converter.fromLatest(value);
    RevValue rv = store.put(index, converter.toBytes(item), values.toArray(new RevValue[0]));
    return new TypeValue<T>(item, rv);
  }
View Full Code Here

Examples of com.google.nigori.common.RevValue

      if (args.length != 7) {
        System.err.println("*** Error: exactly seven elements needed for a put action");
        usage();
        return;
      }
      RevValue success = nigori.put(new Index(args[5]), MessageLibrary.toBytes(args[6]));
      System.out.println("Success: " + success);
    } else if (action.equals("get")) {
      if (args.length != 6) {
        System.err.println("*** Error: exactly six elements needed for a get action");
        usage();
View Full Code Here

Examples of com.google.nigori.common.RevValue

    try {
      secondUser.join();
    } catch (InterruptedException e) {
    }
    // Clean up
    RevValue head = store.getMerging(sharedIndex, new ArbitraryMerger());
    store.removeIndex(sharedIndex, head.getRevision());
    store.unregister();

  }
View Full Code Here

Examples of com.google.nigori.common.RevValue

      byte count = 0;
      try {
        MigoriDatastore sharedStore =
            new HashMigoriDatastore(new CryptoNigoriDatastore(HOST, PORT, "nigori", username,
                password));
        RevValue rv = sharedStore.put(sharedIndex, new byte[] {count++});
        sleep(DELAY * 2);
        for (int i = 0; i < ITERATIONS; ++i) {
          rv = sharedStore.put(sharedIndex, new byte[] {count++}, rv);
          sleep(DELAY * 2);
        }
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.