docstr: Inform the write buffer that bytes before `new_offset` have been
  committed and can be discarded.  After calling advance_offset,
  `self.offset() == new_offset`.
docstr_tok: ["Inform","the","write","buffer","that","bytes","before","`","new_offset","`","have","been","committed","and","can","be","discarded",".","After","calling","advance_offset",",","`","self.offset","(",")","==","new_offset","`","."]
code: def advance_offset(self, new_offset: int):
      """Inform the write buffer that bytes before `new_offset` have been
      committed and can be discarded.  After calling advance_offset,
      `self.offset() == new_offset`."""
      assert not self._iterating
      assert new_offset <= self._offset + self._size
      while self._buffers and new_offset >= self._offset + len(
          self._buffers[0]
      ):
          b = self._buffers.popleft()
          n = len(b)
          self._offset += n
          self._size -= n
      if new_offset > self._offset:
          n = new_offset - self._offset
          b = self._buffers[0]
          assert n < len(b)
          b = b[n:]
          self._buffers[0] = b
          self._offset += n
          self._size -= n
      assert self._offset == new_offset
  
file_path: hail/hail/python/hailtop/aiotools/utils.py
imports: from typing import Deque, TypeVar, AsyncIterator, Iterator
  import collections
  from contextlib import contextmanager
  import asyncio
label_desc: Use image node_id 5 for calling the WriteBuffer obj's underlying member method code with example usage: obj.advance_offset(new_offset) without return types