All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.linkedin.glu.agent.tracker.AgentsTracker.groovy Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2010-2010 LinkedIn, Inc
 * Portions Copyright (c) 2011 Yan Pujante
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */


package org.linkedin.glu.agent.tracker

import org.linkedin.glu.agent.api.MountPoint
import org.linkedin.util.lifecycle.Startable
import org.linkedin.util.lifecycle.Destroyable
import org.linkedin.zookeeper.tracker.ErrorListener

/**
 * Tracks the agents (through zookeeper).
 *
 * @author [email protected]
 */
interface AgentsTracker extends Startable, Destroyable
{
  static final String ZK_AGENTS_INSTANCES =  'instances'
  static final String ZK_AGENTS_STATE     =  'state'

  enum AccuracyLevel
  {
    INACCURATE,
    ACCURATE,
    PARTIAL
  }

  /**
   * Registers an event listener on agents
   */
  void registerAgentListener(TrackerEventsListener> listener)

  /**
   * Registers an event listener on mount points
   */
  void registerMountPointListener(TrackerEventsListener> listener)

  /**
   * listener for handling errors 
   */
  void registerErrorListener(ErrorListener errorListener)

  /**
   * Returns all agent infos
   */
  Map getAgentInfos()

  /**
   * Returns info about the specified agent
   */
  AgentInfo getAgentInfo(String agentName)

  /**
   * Get all mount points for the given agent
   */
  Map getMountPointInfos(String agentName)

  /**
   * Get a single mount point info
   */
  MountPointInfo getMountPointInfo(String agentName, mountPoint)

  /**
   * @return all the mountpoints
   */
  Map> getMountPointInfos()

  /**
   * @return a map [accuracy: _accuracyLevel_, allInfos: [_agentName_: [agent: _agentInfo_, mountPoints: _mountPointInfos_]]
   */
  def getAllInfosWithAccuracy()

  /**
   * Clears the agent info for the given agent
   * @return true if the agent was cleared, false if it was already cleared
   * @throws IllegalStateException when the agent is still up!
   */
  boolean clearAgentInfo(String agentName)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy