Package com.sleepycat.je

Examples of com.sleepycat.je.OperationStatus


    /** {@inheritDoc} */
    public byte[] get(DbTransaction txn, byte[] key, boolean forUpdate) {
  try {
      DatabaseEntry valueEntry = new DatabaseEntry();
      OperationStatus status = db.get(
    JeTransaction.getJeTxn(txn), new DatabaseEntry(key),
    valueEntry, forUpdate ? LockMode.RMW : null);
      if (status == SUCCESS) {
    return convertData(valueEntry.getData());
      } else if (status == NOTFOUND) {
View Full Code Here


    public void markForUpdate(DbTransaction txn, byte[] key) {
  try {
      DatabaseEntry valueEntry = new DatabaseEntry();
      /* Ignore value by truncating to zero bytes */
      valueEntry.setPartial(0, 0, true);
      OperationStatus status = db.get(
    JeTransaction.getJeTxn(txn), new DatabaseEntry(key),
    valueEntry, LockMode.RMW);
      if (status != SUCCESS && status != NOTFOUND) {
    throw new DbDatabaseException("Operation failed: " + status);
      }
View Full Code Here

    }

    /** {@inheritDoc} */
    public void put(DbTransaction txn, byte[] key, byte[] value) {
  try {
      OperationStatus status = db.put(
    JeTransaction.getJeTxn(txn), new DatabaseEntry(key),
    new DatabaseEntry(value));
      if (status != SUCCESS) {
    throw new DbDatabaseException("Operation failed: " + status);
      }
View Full Code Here

    /** {@inheritDoc} */
    public boolean putNoOverwrite(
  DbTransaction txn, byte[] key, byte[] value)
    {
  try {
      OperationStatus status = db.putNoOverwrite(
    JeTransaction.getJeTxn(txn), new DatabaseEntry(key),
    new DatabaseEntry(value));
      if (status == SUCCESS) {
    return true;
      } else if (status == KEYEXIST) {
View Full Code Here

    }

    /** {@inheritDoc} */
    public boolean delete(DbTransaction txn, byte[] key) {
  try {
      OperationStatus status = db.delete(
    JeTransaction.getJeTxn(txn), new DatabaseEntry(key));
      if (status == SUCCESS) {
    return true;
      } else if (status == NOTFOUND) {
    return false;
View Full Code Here

                        boolean errors = false;
                        DatabaseEntry key = new DatabaseEntry();
                        final DatabaseEntry data = new DatabaseEntry();

                        queue.clear();
                        OperationStatus status;
                        if (batchSize > 1) {
                            Cursor cursor = database.openCursor(null, CursorConfig.DEFAULT);
                            try {
                                status = cursor.getFirst(key, data, null);
View Full Code Here

   *            the URL for which the docid is returned.
   * @return the docid of the url if it is seen before. Otherwise -1 is
   *         returned.
   */
  public synchronized int getDocId(String url) {
    OperationStatus result;
    DatabaseEntry value = new DatabaseEntry();
    try {
      DatabaseEntry key = new DatabaseEntry(url.getBytes());
      result = db.get(null, key, value, null);

View Full Code Here

        DatabaseEntry keyEntry = new DatabaseEntry();
        DatabaseEntry pkeyEntry = new DatabaseEntry();
        DatabaseEntry dataEntry = new DatabaseEntry();
        keyBinding.objectToEntry(key, keyEntry);

        OperationStatus status =
            secDb.get(txn, keyEntry, pkeyEntry, dataEntry, lockMode);

        if (status == OperationStatus.SUCCESS) {
            return entityBinding.entryToObject(pkeyEntry, dataEntry);
        } else {
View Full Code Here

        }

        Cursor openCursor(Transaction txn, CursorConfig config)
            throws DatabaseException {

            OperationStatus status;
            Cursor cursor = db.openCursor(txn, config);
            try {
                DatabaseEntry data = BasicIndex.NO_RETURN_ENTRY;
                status = cursor.getSearchKey(key, data, null);
            } catch (DatabaseException e) {
View Full Code Here

            if (joinCursor == null) {
                return null;
            }
            if (doKeys) {
                DatabaseEntry key = new DatabaseEntry();
                OperationStatus status = joinCursor.getNext(key, lockMode);
                if (status == OperationStatus.SUCCESS) {
                    EntryBinding binding = primary.getKeyBinding();
                    return (V) binding.entryToObject(key);
                }
            } else {
                DatabaseEntry key = new DatabaseEntry();
                DatabaseEntry data = new DatabaseEntry();
                OperationStatus status =
                    joinCursor.getNext(key, data, lockMode);
                if (status == OperationStatus.SUCCESS) {
                    EntityBinding binding = primary.getEntityBinding();
                    return (V) binding.entryToObject(key, data);
                }
View Full Code Here

TOP

Related Classes of com.sleepycat.je.OperationStatus

Copyright © 2018 www.massapicom. 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.