Add a reader lock entry for transaction tx on object obj
to the persistent storage.
192409
public boolean addReader(TransactionImpl tx, Object obj)
	{
		try
		{
			LockEntry lock = new LockEntry(new Identity(obj,getBroker()).toString(),
					tx.getGUID(),
					System.currentTimeMillis(),
					LockStrategyFactory.getIsolationLevel(obj),
					LockEntry.LOCK_READ);
            addReaderRemote(lock);
			return true;
		}
		catch (Throwable t)
		{
			log.error("Cannot store LockEntry for object " + obj + " in transaction " + tx, t);
			return false;
		}
	}
1231829
public static void addTxn(TransactionImpl txn)
    {
        if (tc.isEntryEnabled()) Tr.entry(tc, "addTxn", txn);

        final ByteArray key = new ByteArray(txn.getXid().getGlobalTransactionId());

        synchronized (txnTable)
        {
            if (!txnTable.containsKey(key))
            {
                txnTable.put(key, new JCATranWrapperImpl(txn, true, false)); // @LIDB2110C
            }
        }

        if (tc.isEntryEnabled()) Tr.exit(tc, "addTxn");
    }
834978
protected void store(Object obj, Identity oid, ClassDescriptor cld,  boolean insert)
    {
        store(obj, oid, cld, insert, false);
    }
201436
def add(self, item, safe=None):
		''' '''
		item._set_session(self)
		if safe is None:
			safe = self.safe
		self.queue.append(SaveOp(self.transaction_id, self, item, safe))
		# after the save op is recorded, the document has an _id and can be
		# cached
		self.cache_write(item)
		if self.autoflush:
			return self.flush()
249003
public void removeReader(TransactionImpl tx, Object obj)
    {
        checkTimedOutLocks();

        Identity oid = new Identity(obj, getBroker());
        String oidString = oid.toString();
        String txGuid = tx.getGUID();
        removeReaderInternal(oidString, txGuid);
    }
355229
private void write(ManagedObject managedObject)
                    throws ObjectManagerException
    {
        final String methodName = "write";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        methodName,
                        new Object[] { managedObject });

        // Pick up and write the latest serialized bytes.
        ObjectManagerByteArrayOutputStream serializedBytes = null;
        if (usesSerializedForm) {
            // Pick up and write the latest serialized bytes.

            // It is possible that several threads requested a write one after the
            // other each getting the request added to a different managedObjetsToWrite table,
            // however the first of these through here will clear serializedBytes.
            // It is also possible that the transaction state of the managed object
            // was restored from a checkpoint, in which case the serialized object
            // may already be in the ObjectStore, and the serializedBytes will again be null.

            // Is the Object deleted? It may have got deleted after we release the
            // synchronize lock when we
            // captured the tokensToWrite hashtable but before we actually try to write it.
            if (managedObject.state != ManagedObject.stateDeleted)
                serializedBytes = managedObject.freeLatestSerializedBytes();

        } else {
            // Not logged so use the current serialized bytes, as long as its not part of a transaction.
            // If it is part of a transaction then the transaction will hold the ManagedObject in memory.
            // Not locked because this is only used by SAVE_ONLY_ON_SHUTDOWN stores at shutdown
            // when no appliaction threads are active.
            if (managedObject.state == ManagedObject.stateReady)
                serializedBytes = managedObject.getSerializedBytes();
        } // if ( usesSerializedForm ).

        // It is possible that several threads requested a write one after the other each getting the request added
        // to a different tokensToWrite table, however the first of these through here will clear serializedBytes.
        if (serializedBytes != null) { // Already done by another thread?
            try {
                java.io.FileOutputStream storeFileOutputStream = new java.io.FileOutputStream(storeDirectoryName
                                                                                              + java.io.File.separator
                                                                                              + managedObject.owningToken.storedObjectIdentifier);
                storeFileOutputStream.write(serializedBytes.getBuffer(), 0, serializedBytes.getCount());
                storeFileOutputStream.flush();
                storeFileOutputStream.close();

            } catch (java.io.IOException exception) {
                // No FFDC Code Needed.
                ObjectManager.ffdc.processException(this,
                                                    cclass,
                                                    methodName,
                                                    exception,
                                                    "1:656:1.17");

                if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                    trace.exit(this,
                               cclass,
                               methodName,
                               new Object[] { exception });
                throw new PermanentIOException(this,
                                               exception);
            } // catch java.io.IOException.

            managedObjectsOnDisk.add(new Long(managedObject.owningToken.storedObjectIdentifier));
        } // if (serializedBytes != null ).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       methodName);
    }
955419
function putItem(value) {
  return new Promise((resolve, reject) => {
    return instance.pkgs.then(db => {
      const obj = db.transaction(db.name, 'readwrite')
        .objectStore(db.name);
      const req = obj.put(value);
      req.onerror = event => reject(event);
      req.onsuccess = () => resolve();
    });
  });
}
256972
def add(self, data):
        """"""
        assert isinstance(data, bytes)
        with self.lock:
            self.buf += data
736907
public boolean hasReadLock(TransactionImpl tx, Object obj)
    {
        checkTimedOutLocks();

        Identity oid = new Identity(obj,getBroker());
        String oidString = oid.toString();
		String txGuid = tx.getGUID();
        return hasReadLockInternal(oidString, txGuid);
    }
480199
def add_txn_opts!(command, read)
      command.tap do |c|
        # The read preference should be added for all read operations.
        if read && txn_read_pref = txn_read_preference
          Mongo::Lint.validate_underscore_read_preference(txn_read_pref)
          txn_read_pref = txn_read_pref.dup
          txn_read_pref[:mode] = txn_read_pref[:mode].to_s.gsub(/(_\w)/) { |match| match[1].upcase }
          Mongo::Lint.validate_camel_case_read_preference(txn_read_pref)
          c['$readPreference'] = txn_read_pref
        end

        # The read concern should be added to any command that starts a transaction.
        if starting_transaction?
          # https://jira.mongodb.org/browse/SPEC-1161: transaction's
          # read concern overrides collection/database/client read concerns,
          # even if transaction's read concern is not set.
          # Read concern here is the one sent to the server and may
          # include afterClusterTime.
          if rc = c[:readConcern]
            rc = rc.dup
            rc.delete(:level)
          end
          if txn_read_concern
            if rc
              rc.update(txn_read_concern)
            else
              rc = txn_read_concern.dup
            end
          end
          if rc.nil? || rc.empty?
            c.delete(:readConcern)
          else
            c[:readConcern ] = rc
          end
        end

        # We need to send the read concern level as a string rather than a symbol.
        if c[:readConcern] && c[:readConcern][:level]
          c[:readConcern][:level] = c[:readConcern][:level].to_s
        end

        # The write concern should be added to any abortTransaction or commitTransaction command.
        if (c[:abortTransaction] || c[:commitTransaction])
          if @already_committed
            wc = BSON::Document.new(c[:writeConcern] || txn_write_concern || {})
            wc.merge!(w: :majority)
            wc[:wtimeout] ||= 10000
            c[:writeConcern] = wc
          elsif txn_write_concern
            c[:writeConcern] ||= txn_write_concern
          end
        end

        # A non-numeric write concern w value needs to be sent as a string rather than a symbol.
        if c[:writeConcern] && c[:writeConcern][:w] && c[:writeConcern][:w].is_a?(Symbol)
          c[:writeConcern][:w] = c[:writeConcern][:w].to_s
        end
      end
    end
1197356
protected synchronized void addFromCheckpoint(ManagedObject managedObject,
                                                  Transaction transaction)
                    throws ObjectManagerException
    {
        throw new InvalidStateException(this, InternalTransaction.stateTerminated, InternalTransaction.stateNames[InternalTransaction.stateTerminated]);
    }
392469
public IEntityLock newReadLock(EntityIdentifier entityID, String owner)
            throws LockingException {
        return lockService.newLock(
                entityID.getType(), entityID.getKey(), IEntityLockService.READ_LOCK, owner);
    }
322625
public void updateDataOnly(Transaction tran, ObjectStore store) throws PersistenceException, ObjectManagerException, SevereMessageStoreException
    {
        updateDataOnly(tran, store, this);
    }
43786
def add_object(self, start, obj, object_size):
        

        self._store(start, obj, object_size, overwrite=False)
336872
public boolean writeLock(TransactionImpl tx, Object obj)
    {
        LockEntry writer = getWriter(obj);
        if (writer == null)
        {
            if (setWriter(tx, obj))
                return true;
            else
                return writeLock(tx, obj);
        }
        if (writer.isOwnedBy(tx))
        {
            return true;    // If I'm the writer, then I can write.
        }
        return false;
    }
328109
public void insert() {
		// Block read-only transaction
		if (tx.isReadOnly() && !isTempTable())
			throw new UnsupportedOperationException();

		// Insertion may change the properties of this file,
		// so that we need to lock the file.
		if (!isTempTable())
			tx.concurrencyMgr().modifyFile(fileName);

		// Modify the free chain which is start from a pointer in
		// the header of the file.
		if (fhp == null)
			fhp = openHeaderForModification();

		// Log that this logical operation starts
		tx.recoveryMgr().logLogicalStart();

		if (fhp.hasDeletedSlots()) {
			// Insert into a deleted slot
			moveToRecordId(fhp.getLastDeletedSlot());
			RecordId lds = rp.insertIntoDeletedSlot();
			fhp.setLastDeletedSlot(lds);
		} else {
			// Insert into a empty slot
			if (!fhp.hasDataRecords()) { // no record inserted before
				// Create the first data block
				appendBlock();
				moveTo(1);
				rp.insertIntoNextEmptySlot();
			} else {
				// Find the tail page
				RecordId tailSlot = fhp.getTailSolt();
				moveToRecordId(tailSlot);
				while (!rp.insertIntoNextEmptySlot()) {
					if (atLastBlock())
						appendBlock();
					moveTo(currentBlkNum + 1);
				}
			}
			fhp.setTailSolt(currentRecordId());
		}

		// Log that this logical operation ends
		RecordId insertedRid = currentRecordId();
		tx.recoveryMgr().logRecordFileInsertionEnd(ti.tableName(), insertedRid.block().number(), insertedRid.id());

		// Close the header (release the header lock)
		closeHeader();
	}
315707
def _AcquireLock(self,
                   urn,
                   blocking=None,
                   blocking_lock_timeout=None,
                   lease_time=None,
                   blocking_sleep_interval=None):
    """"""
    if urn is None:
      raise ValueError("URN cannot be None")

    urn = rdfvalue.RDFURN(urn)

    try:
      return data_store.DB.LockRetryWrapper(
          urn,
          retrywrap_timeout=blocking_sleep_interval,
          retrywrap_max_timeout=blocking_lock_timeout,
          blocking=blocking,
          lease_time=lease_time)
    except data_store.DBSubjectLockError as e:
      raise LockError(e)