This project has retired. For details please refer to its Attic page.
Source code
001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019
020package org.apache.reef.io.network.naming;
021
022import org.apache.reef.io.naming.NameAssignment;
023import org.apache.reef.tang.annotations.DefaultImplementation;
024import org.apache.reef.wake.Identifier;
025import org.apache.reef.wake.Stage;
026
027import java.net.InetSocketAddress;
028import java.util.List;
029
030/**
031 * Naming server interface.
032 */
033@DefaultImplementation(NameServerImpl.class)
034public interface NameServer extends Stage {
035
036  /**
037   * get port number.
038   * @return
039   */
040  int getPort();
041
042  /**
043   * Registers an (identifier, address) mapping locally.
044   *
045   * @param id   an identifier
046   * @param addr an Internet socket address
047   */
048  void register(final Identifier id, final InetSocketAddress addr);
049
050  /**
051   * Unregisters an identifier locally.
052   *
053   * @param id an identifier
054   */
055  void unregister(final Identifier id);
056
057  /**
058   * Finds an address for an identifier locally.
059   *
060   * @param id an identifier
061   * @return an Internet socket address
062   */
063  InetSocketAddress lookup(final Identifier id);
064
065  /**
066   * Finds addresses for identifiers locally.
067   *
068   * @param identifiers an Iterable of identifiers
069   * @return a list of name assignments
070   */
071  List<NameAssignment> lookup(final Iterable<Identifier> identifiers);
072}