BUG-7976: Race between peer removal and routes update
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / spi / PeerExportGroupRegistry.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.bgp.rib.impl.spi;
9
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.protocol.bgp.rib.spi.PeerExportGroup;
12 import org.opendaylight.protocol.concepts.AbstractRegistration;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerId;
14
15 /**
16  * PeerExportGroup Registry. Register should be maintained in blocking mode to avoid race between
17  * updating the routes and notify to a peer which doesn't longer exist. BUG-7676
18  */
19 @Beta
20 public interface PeerExportGroupRegistry extends PeerExportGroup {
21     /**
22      * Register peer to this exportGroup
23      *
24      * @param peerId         Peer Id
25      * @param peerExporTuple Peer Export Tuple
26      * @return registration ticket which take allows to unregister peer
27      */
28     AbstractRegistration registerPeer(PeerId peerId, PeerExporTuple peerExporTuple);
29
30     /**
31      * @return true if none peer is registered.
32      */
33     boolean isEmpty();
34 }