/*
 * JBoss, Home of Professional Open Source
 * Copyright 2005, JBoss Inc., and individual contributors as indicated
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.cache;


import org.jgroups.View;

/**
 * Callbacks for various events regarding TreeCache. Implementers should avoid performing long running actions,
 * as this blocks the cache. If you have to do so, please start a new thread.
 * @author Bela Ban
 * @author Ben Wang
 * @version $Revision: 1.4.2.8 $
 */
public interface TreeCacheListener {
   /**
    * Called when a node is created
    * @param fqn
    */
   void nodeCreated(Fqn fqn);

   /**
    * Called when a node is removed.
    * @param fqn
    */
   void nodeRemoved(Fqn fqn);

   /**
    * Called when a node is loaded into memory via the CacheLoader. This is not the same
    * as {@link #nodeCreated(Fqn)}.
    */
   void nodeLoaded(Fqn fqn);


   /**
    * Called when a node is evicted (not the same as remove()).
    * @param fqn
    */
   void nodeEvicted(Fqn fqn);

   /**
    * Called when a node is modified, e.g., one (key, value) pair
    * in the internal map storage has been modified.
    * @param fqn
    */
   void nodeModified(Fqn fqn);

   /**
    * Called when a node is visisted, i.e., get().
    * @param fqn
    */
   void nodeVisited(Fqn fqn);

   /**
    * Called when the cache is started.
    * @param cache
    */
   void cacheStarted(TreeCache cache);

   /**
    * Called when the cache is stopped.
    * @param cache
    */
   void cacheStopped(TreeCache cache);

   void viewChange(View new_view);  // might be MergeView after merging
}
