This is a semi-private method. It's current use is to
        manipulate memory file system objects so that
        you can create certain conditions, to provoke
        errors that otherwise won't occur.
970327
def _manipulate(self, *args, **kwargs):
        
        self.connection._manipulate(self, *args, **kwargs)
670170
function(fn) {
      var visitedDumps = new WeakSet();

      function visit(dump) {
        if (visitedDumps.has(dump))
          return;

        // If this dumps owns another dump which hasn't been visited yet, then
        // wait for this dump to be visited later.
        if (dump.owns !== undefined && !visitedDumps.has(dump.owns.target))
          return;

        // If this dump's parent hasn't been visited yet, then wait for this
        // dump to be visited later.
        if (dump.parent !== undefined && !visitedDumps.has(dump.parent))
          return;

        // Actually visit the current memory allocator dump.
        fn.call(this, dump);
        visitedDumps.add(dump);

        // Visit owners after the dumps they own.
        dump.ownedBy.forEach(function(ownershipLink) {
          visit.call(this, ownershipLink.source);
        }, this);

        // Visit children after parents.
        dump.children.forEach(visit, this);
      }

      this.iterateAllRootAllocatorDumps(visit);
    }
580028
public void compact() {
    if (prev == this) throw new IllegalStateException();
    if (!prev.owner) return; // Cannot compact: prev isn't writable.
    int byteCount = limit - pos;
    int availableByteCount = SIZE - prev.limit + (prev.shared ? 0 : prev.pos);
    if (byteCount > availableByteCount) return; // Cannot compact: not enough writable space.
    writeTo(prev, byteCount);
    pop();
    SegmentPool.recycle(this);
  }
296971
void rollIfNeeded() throws IOException {
    if (numberOfParts == 1 || numberOfFiles < 1) {
      return;
    }
    filesCount++;
    if (filesCount % filesPerRoll == 0) {
      out.close();
      currentPart++;
      createOutputStream();
    }
  }
611431
void checkRecallValidity() {
    double x0 = recall.exec(this, 0);
    for (int i = 1; i < _nBins; i++) {
      double x1 = recall.exec(this, i);
      if (x0 > x1)
        throw new H2OIllegalArgumentException(String.valueOf(i), "recall", x0 + " > " + x1);
      x0 = x1;
    }
  }
1161945
private boolean canWriteErrorDir(File errorPath) {
        String[] files = errorPath.list();
        if (files != null && files.length > FILE_CONTENT_LOG_MAX_FILE_NUM) {
            long now = System.currentTimeMillis();
            int delNum = 0;
            for (String filename : files) {
                File errImg = new File(errorPath, filename);
                if (now - errImg.lastModified() > EXPIRED_PERIOD) {
                    errImg.delete();
                    delNum++;
                }
            }

            if (files.length - delNum <= FILE_CONTENT_LOG_MAX_FILE_NUM) {
                return true;
            }

            return false;
        }

        return true;
    }
411292
synchronized void reportErrorsOnDirectory(StorageDirectory sd, 
      FSImage image) {
    String lsd = listStorageDirectories();
    LOG.info("reportErrorsOnDirectory: Current list of storage dirs:" + lsd);

    LOG.error("reportErrorsOnDirectory: Error reported on storage directory "
        + sd.getRoot());

    if (this.storageDirs.remove(sd)) {
      try {
        sd.unlock();
      } catch (Exception e) {
        LOG.warn(
            "reportErrorsOnDirectory: Unable to unlock bad storage directory: "
                + sd.getRoot().getPath(), e);
      }
      this.removedStorageDirs.add(sd);
    }
    if (image != null) {
      image.reportErrorsOnImageManager(sd);
    }
    
    lsd = listStorageDirectories();
    LOG.info("reportErrorsOnDirectory: Current list of storage dirs:" + lsd);
  }
484521
private boolean updateMemoryReservation()
    {
        // Operator/driver will be blocked on memory after we call localUserMemoryContext.setBytes().
        // If memory is not available, once we return, this operator will be blocked until memory is available.
        long memorySizeInBytes = groupByHash.map(GroupByHash::getEstimatedSize).orElse(0L) + partitionRowCount.sizeOf();
        localUserMemoryContext.setBytes(memorySizeInBytes);
        // If memory is not available, inform the caller that we cannot proceed for allocation.
        return operatorContext.isWaitingForMemory().isDone();
    }
1127601
public void freeCurrent() {
		int beforeReleaseNum = availableMemory.size();
		memManager.release(availableMemory);
		allocatedFloatingNum -= (beforeReleaseNum - availableMemory.size());
	}
665252
private void mapAndSetOffset() {
        try {
            final RandomAccessFile backingFile = new RandomAccessFile(this.file, "rw");
            backingFile.setLength(this.size);
            final FileChannel ch = backingFile.getChannel();
            this.addr = (Long) mmap.invoke(ch, 1, 0L, this.size);

            ch.close();
            backingFile.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
508252
public void releaseAllChunkMemoryUsage()
  {
    if (chunks == null || chunks.size() == 0)
    {
      return;
    }

    for (int i = 0; i < chunks.size(); i++)
    {
      releaseCurrentMemoryUsage(i, chunks.get(i).computeNeededChunkMemory());
    }
  }
1270557
function MemoryAdapter(initialFiles) {
    if (!(this instanceof MemoryAdapter)) {
        return new MemoryAdapter(initialFiles);
    }

    this.entries = new Map();

    // load initial file buffers
    if (typeof initialFiles === "object" && initialFiles) {
        Object.keys(initialFiles).forEach((fileName) => {
            const buf = Buffer.from(initialFiles[fileName]);
            this.entries.set(fileName, buf);
        });
    }
}
1104600
function (storeOrEditor, from, to) {
    debug('Performing inMemoryCopy from ' + from + ' to ' + to + '.');
    var fromLen = from.length;
    this.processInMemoryStore(storeOrEditor, (file, store) => {
      var idx = file.path.indexOf(from);
      if (idx === 0 && file.contents !== null && file.state !== 'deleted') {
        var absTo = path.join(to, file.path.substr(fromLen));
        // exact match so we are copying a single file and not a folder
        if (fromLen === file.path.length) {
          absTo = path.join(to, path.basename(file.path));
        }
        debug('CREATING COPY IN-MEMORY: ' + absTo);
        var newFile = store.get(absTo);
        newFile.contents = file.contents;
        newFile.state = 'modified';
        store.add(newFile);
      }
    });
  }
459442
public void cache_free_storage_info()
    throws IOException
    {
        Block block;
        byte[] buf;
        ByteArrayPlusOutputStream bos;
        long cache_size;
        DataOutputStream dos;
        int qlist_num;

        if (readOnly) {
            throw (new FileManagerException("Attempt to cache free storage information in read only mode"));
        }
        cache_size = (2*LONG_SIZE) + ((free_blocks + nonempty_lists) *
                                      (INT_SIZE + PTR_SIZE));
        bos = new ByteArrayPlusOutputStream((int) cache_size);
        dos = new DataOutputStream(bos);
        dos.writeLong(allocated_blocks);
        dos.writeLong(allocated_words);
        for (qlist_num = 0; qlist_num <= last_ql_index;
            qlist_num++) {
            if (ql_heads[qlist_num].first_block != null) {
                dos.writeInt(qlist_num);
                block = ql_heads[qlist_num].first_block;
                while (block != null) {
                    dos.writeLong(block.address); 
                    dos.writeInt(block.size); 
                    block = block.next;
                }
                dos.writeLong(DISK_NULL);
            }
        }
        dos.close();
        bos.close();
        buf = bos.getTheBuffer();

        seek(tail_ptr);
        write(buf);
        seek(CACHE_END);
        writeLong(tail_ptr + cache_size);
    }
888471
private void ensureEntryArrayMutable() {
    checkMutable();
    if (entryList.isEmpty() && !(entryList instanceof ArrayList)) {
      entryList = new ArrayList<Entry>(maxArraySize);
    }
  }
1187628
private void handleReopenForStorageException(final StorageException exs) throws StorageException {
    reopens++;
    if (reopens > maxReopens) {
      throw new StorageException(
          exs.getCode(),
          "All "
              + maxReopens
              + " reopens failed. Waited a total of "
              + totalWaitTime
              + " ms between attempts",
          exs);
    }
    sleepForAttempt(reopens);
  }
284400
function(callback) {

            // first check if storage define a 'keys()' function. if it does, use it
            if (typeof this._storage.keys === "function") {
                var keys = this._storage.keys();
                for (var i = 0; i < keys.length; ++i) {
                    callback(keys[i]);
                }
            }

            // if not supported try to use object.keys
            else if (typeof Object === "function" && Object.keys) {
                var keys = Object.keys(this._storage);
                for (var i = 0; i < keys.length; ++i) {
                    callback(keys[i]);
                }
            }

            // if not supported try to use iteration via length
            else if (this._storage.length !== undefined && typeof this._storage.key === "function") {

                // first build keys array, so this function will be delete-safe (eg if callback remove keys it won't cause problems due to index change)
                var keys = [];
                for (var i = 0, len = this._storage.length; i < len; ++i) {
                    keys.push(this._storage.key(i));
                }
                // now actually iterate keys
                for (var i = 0; i < keys.length; ++i) {
                    callback(keys[i]);
                }
            }

            // if both methods above didn't work, iterate on all keys in storage class hoping for the best..
            else {
                for (var storageKey in this._storage) {
                    callback(storageKey);
                }
            }
        }