decide if this memtable should take the write, or if it should go to the next memtable
334098
public boolean accepts(OpOrder.Group opGroup, ReplayPosition replayPosition)
    {
        // if the barrier hasn't been set yet, then this memtable is still taking ALL writes
        OpOrder.Barrier barrier = this.writeBarrier;
        if (barrier == null)
            return true;
        // if the barrier has been set, but is in the past, we are definitely destined for a future memtable
        if (!barrier.isAfter(opGroup))
            return false;
        // if we aren't durable we are directed only by the barrier
        if (replayPosition == null)
            return true;
        while (true)
        {
            // otherwise we check if we are in the past/future wrt the CL boundary;
            // if the boundary hasn't been finalised yet, we simply update it to the max of
            // its current value and ours; if it HAS been finalised, we simply accept its judgement
            // this permits us to coordinate a safe boundary, as the boundary choice is made
            // atomically wrt our max() maintenance, so an operation cannot sneak into the past
            ReplayPosition currentLast = lastReplayPosition.get();
            if (currentLast instanceof LastReplayPosition)
                return currentLast.compareTo(replayPosition) >= 0;
            if (currentLast != null && currentLast.compareTo(replayPosition) >= 0)
                return true;
            if (lastReplayPosition.compareAndSet(currentLast, replayPosition))
                return true;
        }
    }
340701
@Override
  public synchronized void write(final int b) {
    BufferPool.Buffer buff = getBuffer(count, false);

    if (buff == null) {
      buff = newBuffer();
    }

    if (!buff.putByte(b)) {
      buff = newBuffer();
      if (!buff.putByte(b)) {
        throw new RuntimeException("Logic error in write(b)");
      }
    }

    count++;
  }
650397
private void checkWrite(int size) {
    // If the buffer does not have enough bytes remaining, attempt to discard some of the read bytes.
    // It is possible that the buffer could discard 0 bytes, so we ensure the buffer is writable after
    // discarding some read bytes, and if not discard all read bytes.
    if (buffer.writerIndex() + size > buffer.maxCapacity()) {
      buffer.discardSomeReadBytes();
      if (buffer.writerIndex() + size > buffer.maxCapacity()) {
        buffer.discardReadBytes();
      }
    }
  }
425306
def writelines(self, seq):
        
        self._check_writable()
        for line in seq:
            self._transport._can_write.wait()
            self._transport.write(line)
845017
public function onAfterWrite()
    {
        parent::onAfterWrite();

        // Check if an order number has been generated, if not, add it and save again
        if (!$this->Ref) {
            $this->Ref = $this->generateOrderNumber();
            $this->write();
        }
    }
408073
def write(self, fn=None):
        """"""
        fn = fn or self.fn
        if not os.path.exists(os.path.dirname(fn)):
            os.makedirs(os.path.dirname(fn))
        f = open(self.fn, 'rb')
        b = f.read()
        f.close()
        f = open(fn, 'wb')
        f.write(b)
        f.close()
86132
def b(memo, other)
      other.keys.each do |sort|
        if keys.include?(sort) && !memo.keys.include?(sort)
          memo << other.assoc(sort)
        end
      end
    end
1165481
public void write(int b) throws IOException {
    while (true) {
      lockW.lock();
      try {
        // fail if closed
        checkClosed();
        
        if (length - availableCount.get() > 0) {
          bytes[writeCursor] = (byte) b;
          incWriteCursor(1);
          availableCount.incrementAndGet();
          totalWritten++;
          return;
        }
      } finally {
        lockW.unlock();
      }
      sleep(1);
    }
  }
429127
def next(self):
        """"""
        if self._iter_n < self.n_blocks:
            result = self[self._iter_n]
            self._iter_n += 1
            return result
        else:
            raise StopIteration
877734
public function onAfterWrite() {
		if (!self::$indexing) return;

		// No longer doing the 'ischanged' check to avoid problems with multivalue field NOT being indexed
		//$changes = $this->owner->getChangedFields(true, 2);
			
		$stage = null;
		// if it's being written and a versionable, then save only in the draft
		// repository. 
		if ($this->owner->hasMethod('canBeVersioned') && $this->owner->canBeVersioned($this->owner->baseTable())) {
            $stage = Versioned::current_stage();
		}

		if ($this->canShowInSearch()) {
            // DataObject::write() does _not_ set LastEdited until _after_ onAfterWrite completes
            $this->owner->LastEdited = date('Y-m-d H:i:s');
			$this->reindex($stage);
		}
	}
706001
@Override
    public void write(byte[] b, int off, int len) throws IOException {
        if (currentEntry != null && !currentEntry.isDirectory()) {
            if (currentEntry.getSize() < currentFileSize + len) {
                throw new IOException( "The current entry[" + currentEntry.getName() + "] size["
                        + currentEntry.getSize() + "] is smaller than the bytes[" + ( currentFileSize + len )
                        + "] being written." );
            }
        }

        out.write( b, off, len );
        
        bytesWritten += len;

        if (currentEntry != null) {
            currentFileSize += len;
        }        
    }
755000
def handle_write(self):
        """"""
        num_sent = self.send(self.write_buffer)
        if self.debug:
            if self.state is not STATE_NOT_STARTED or options.password is None:
                self.print_debug(b'<== ' + self.write_buffer[:num_sent])
        self.write_buffer = self.write_buffer[num_sent:]
456253
def Next(self):
        
        try:
            self.key, self.value = next(self.current)
        except StopIteration:

            if self.current != self.second:
                self.current = self.second
                return self.Next()

            return False

        return True
1373081
void checkWriteSuspend(ChannelHandlerContext ctx, long delay, long queueSize) {
        if (queueSize > maxWriteSize || delay > maxWriteDelay) {
            setUserDefinedWritability(ctx, false);
        }
    }
187647
def borrow_or_take(self, now, can_borrow):
        
        with self._lock:
            return self._borrow_or_take(now, can_borrow)
456984
def write(self, auth, resource, value, options={}, defer=False):
        
        return self._call('write', auth, [resource, value, options], defer)
175173
def take(self):
        
        with self._lock:
            now = int(time.time())

            if now != self.this_sec:
                self.used_this_sec = 0
                self.this_sec = now

            if self.used_this_sec >= self.traces_per_sec:
                return False

            self.used_this_sec = self.used_this_sec + 1
            return True