This method iterates over all entries in the FlatFile and removes the
 entry and inserts it again. This is useful to update all entries in
 case the storage format has changed.
180778
def refresh
      # This iteration might look scary as we iterate over the entries while
      # while we are rearranging them. Re-inserted items may be inserted
      # before or at the current entry and this is fine. They also may be
      # inserted after the current entry and will be re-read again unless they
      # are inserted after the original file end.
      file_size = @f.size

      # We don't update the index and the space list during this operation as
      # we defragmentize the blob file at the end. We'll end the operation
      # with an empty space list.
      clear_index_files

      @progressmeter.start('Converting objects to new storage format',
                           @f.size) do |pm|
        each_blob_header do |header|
          if header.is_valid?
            buf = read_obj_by_address(header.addr, header.id)
            delete_obj_by_address(header.addr, header.id)
            write_obj_by_id(header.id, buf)
          end

          # Some re-inserted blobs may be inserted after the original file end.
          # No need to process those blobs again.
          break if header.addr >= file_size

          pm.update(header.addr)
        end
      end

      # Reclaim the space saved by compressing entries.
      defragmentize

      # Recreate the index file and create an empty space list.
      regenerate_index_and_spaces
    end
1174639
protected void flush ()
    {
        if (!_canFlush) {
            return;
        }

        // If we've exceeded our size, remove things until we're back
        // under the required size.
        if (_size > _maxSize) {
            // This works because the entrySet iterator of a LinkedHashMap
            // returns the entries in LRU order
            Iterator<Map.Entry<K,V>> iter = _delegate.entrySet().iterator();
            // don't remove the last entry, even if it's too big, because
            // a cache with nothing in it sucks
            for (int ii = size(); (ii > 1) && (_size > _maxSize); ii--) {
                Map.Entry<K,V> entry = iter.next();
                entryRemoved(entry.getValue());
                iter.remove();
            }
        }
    }
115677
def update_entries(entries: Entries, data: dict) -> None:
        """"""
        # TODO: Is mutating the list okay, making copies is such a pain in the ass
        for entry in entries:
            entry.update(data)
575139
private void deallocate(HashtableEntry entry)
                    throws IOException,
                    EOFException,
                    FileManagerException,
                    ClassNotFoundException,
                    HashtableOnDiskException {
        if (entry.location == 0) {
            throw (new HashtableOnDiskException("deallocate:  space not allocated."));
        }

        filemgr.deallocate(entry.location);
        entry.location = 0;
    }
881256
def run(self, change):
        

        if self._formats is None:
            self.setup()

        entry = self.entry

        for fmt in self._formats:
            fmt.run(change, entry)

        self.clear()
737851
private void clearEdit() {

        m_fileTable.setEditable(false);
        if (m_editItemId != null) {
            updateItem(m_editItemId, false);
        }
        m_editItemId = null;
        m_editProperty = null;
        m_editHandler = null;
        updateSorting();
    }
656767
public static void addEntries(File zip, ZipEntrySource[] entries, OutputStream destOut) {
    if (log.isDebugEnabled()) {
      log.debug("Copying '" + zip + "' to a stream and adding " + Arrays.asList(entries) + ".");
    }

    ZipOutputStream out = null;
    try {
      out = new ZipOutputStream(destOut);
      copyEntries(zip, out);
      for (int i = 0; i < entries.length; i++) {
        addEntry(entries[i], out);
      }
      out.finish();
    }
    catch (IOException e) {
      ZipExceptionUtil.rethrow(e);
    }
  }
109212
def update(self, puts, deletes):
        
        with self._lmdb.begin(write=True, buffers=True) as txn:
            cursor = txn.cursor(self._main_db)
            # Process deletes first, to handle the case of new items replacing
            # old index locations
            for key in deletes:
                if not cursor.set_key(key.encode()):
                    # value doesn't exist
                    continue

                value = self._deserializer(bytes(cursor.value()))
                cursor.delete()

                for (index_db, index_key_fn) in self._indexes.values():
                    index_keys = index_key_fn(value)
                    index_cursor = txn.cursor(index_db)
                    for idx_key in index_keys:
                        if index_cursor.set_key(idx_key):
                            index_cursor.delete()

            # process all the inserts
            for key, value in puts:
                packed = self._serializer(value)

                cursor.put(key.encode(), packed, overwrite=True)

                for (index_db, index_key_fn) in self._indexes.values():
                    index_keys = index_key_fn(value)
                    index_cursor = txn.cursor(index_db)
                    for idx_key in index_keys:
                        index_cursor.put(idx_key, key.encode())

        self.sync()
900612
public static boolean replaceEntries(final File zip, final ZipEntrySource[] entries) {
    return operateInPlace(zip, new InPlaceAction() {
      public boolean act(File tmpFile) {
        return replaceEntries(zip, entries, tmpFile);
      }
    });
  }
1202783
synchronized void clear() throws IOException
   {
      if (out != null)
      {
         out.close();
         out = null;
      }
      try
      {
         if (dir.fileExists(REDO_LOG))
         {
            dir.deleteFile(REDO_LOG);
         }
      }
      catch (IOException e)
      {
         log.error(e.getLocalizedMessage(), e);
         throw e;
      }
      entryCount = 0;
   }
989143
public void storeKeys(Iterator<K> iterator) {
        long startedNanos = System.nanoTime();
        FileOutputStream fos = null;
        try {
            buf = allocate(BUFFER_SIZE);
            lastWrittenBytes = 0;
            lastKeyCount = 0;

            fos = new FileOutputStream(tmpStoreFile, false);

            // write header and keys
            writeInt(fos, MAGIC_BYTES);
            writeInt(fos, FileFormat.INTERLEAVED_LENGTH_FIELD.ordinal());
            writeKeySet(fos, fos.getChannel(), iterator);

            // cleanup if no keys have been written
            if (lastKeyCount == 0) {
                deleteQuietly(storeFile);
                updatePersistenceStats(startedNanos);
                return;
            }

            fos.flush();
            closeResource(fos);
            rename(tmpStoreFile, storeFile);

            updatePersistenceStats(startedNanos);
        } catch (Exception e) {
            logger.warning(format("Could not store keys of Near Cache %s (%s)", nearCacheName, storeFile.getAbsolutePath()), e);

            nearCacheStats.addPersistenceFailure(e);
        } finally {
            closeResource(fos);
            deleteQuietly(tmpStoreFile);
        }
    }
274827
public void insertAll(List<E> entries) {
    if(!initialized && !entries.isEmpty()) {
      initialize(entries.get(0));
    }
    for(E entry : entries) {
      insert(entry, false);
    }
  }
520206
@SuppressWarnings("unchecked")
  public void clear() {
    this.capacity = this.initialCapacity;
    this.hash_mask = capacity - 1;

    this.expandThreshold = (int) (capacity * maxLoadFactor);
    this.shrinkThreshold = (int) (capacity * minLoadFactor);

    entries = new LinkedElement[capacity];
    size = 0;
    modification++;
  }
410991
def update_input(filelist, ivmlist=None, removed_files=None):
    
    newfilelist = []

    if removed_files == []:
        return filelist, ivmlist
    else:
        sci_ivm = list(zip(filelist, ivmlist))
        for f in removed_files:
            result=[sci_ivm.remove(t) for t in sci_ivm if t[0] == f ]
        ivmlist = [el[1] for el in sci_ivm]
        newfilelist = [el[0] for el in sci_ivm]
        return newfilelist, ivmlist
426179
private void deleteEntryFiles(List<Entry<V>> list) throws IOException {
    for(Entry<V> e: list) {
      File file = e.getFile();
      if(file != null && file.exists()) {
        if (file.delete()) {
          _log.info(file.getName() + " deleted");
        } else {
          _log.warn(file.getName() + " not deleted");
        }
      }
    }
  }
18004
@VisibleForTesting
    void removeAllCacheEntries() {
        List<CacheEntry> entries;
        synchronized (this.cacheEntries) {
            entries = new ArrayList<>(this.cacheEntries.values());
            this.cacheEntries.clear();
        }

        removeFromCache(entries);
        if (entries.size() > 0) {
            log.debug("{}: Cleared all cache entries ({}).", this.traceObjectId, entries.size());
        }
    }
1187152
public void remove()
  {
    if (tc.isEntryEnabled()) 
      SibTr.entry(tc, "remove");
    
    if (anycastIHIterator != null)
    {  
      anycastIHIterator.remove();
    }
    
    if (tc.isEntryEnabled()) 
      SibTr.exit(tc, "remove");
  }