blob: 716168de22b9b57eb6c1dce29325eb40b1dafe92 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2014-present Open Networking Foundation
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.cluster;
tome4729872014-09-23 00:37:37 -070017
Madan Jampani7d2fab22015-03-18 17:21:57 -070018import org.onlab.packet.IpAddress;
Jordan Haltermanf70bf462017-07-29 13:12:00 -070019import org.onosproject.core.Version;
Madan Jampani7d2fab22015-03-18 17:21:57 -070020import org.onosproject.store.Store;
21
Yuta HIGUCHI0c47d532017-08-18 23:16:35 -070022import java.time.Instant;
Thomas Vachuskade563cf2015-04-01 00:28:50 -070023import java.util.Set;
24
tome4729872014-09-23 00:37:37 -070025/**
26 * Manages inventory of controller cluster nodes; not intended for direct use.
27 */
tom0755a362014-09-24 11:54:43 -070028public interface ClusterStore extends Store<ClusterEvent, ClusterStoreDelegate> {
tome4729872014-09-23 00:37:37 -070029
30 /**
tomb41d1ac2014-09-24 01:51:24 -070031 * Returns the local controller node.
tome4729872014-09-23 00:37:37 -070032 *
33 * @return local controller instance
34 */
35 ControllerNode getLocalNode();
36
37 /**
Jordan Halterman00e92da2018-05-22 23:05:52 -070038 * Returns the set of storage nodes.
39 *
40 * @return set of storage nodes
41 */
42 Set<Node> getStorageNodes();
43
44 /**
tome4729872014-09-23 00:37:37 -070045 * Returns the set of current cluster members.
46 *
47 * @return set of cluster members
48 */
49 Set<ControllerNode> getNodes();
50
51 /**
tomb41d1ac2014-09-24 01:51:24 -070052 * Returns the specified controller node.
tome4729872014-09-23 00:37:37 -070053 *
54 * @param nodeId controller instance identifier
55 * @return controller instance
56 */
57 ControllerNode getNode(NodeId nodeId);
58
59 /**
tomb41d1ac2014-09-24 01:51:24 -070060 * Returns the availability state of the specified controller node.
tome4729872014-09-23 00:37:37 -070061 *
62 * @param nodeId controller instance identifier
63 * @return availability state
64 */
65 ControllerNode.State getState(NodeId nodeId);
66
tomb41d1ac2014-09-24 01:51:24 -070067 /**
Jordan Haltermanf70bf462017-07-29 13:12:00 -070068 * Returns the version of the specified controller node.
69 *
70 * @param nodeId controller instance identifier
71 * @return controller version
72 */
73 Version getVersion(NodeId nodeId);
74
75 /**
Thomas Vachuska7a8de842016-03-07 20:56:35 -080076 * Marks the current node as fully started.
77 *
78 * @param started true indicates all components have been started
79 */
80 void markFullyStarted(boolean started);
81
82 /**
Madan Jampani7d2fab22015-03-18 17:21:57 -070083 * Returns the system when the availability state was last updated.
84 *
85 * @param nodeId controller node identifier
86 * @return system time when the availability state was last updated.
87 */
Ray Milkey4f7e3632019-02-19 15:35:20 -080088 Instant getLastUpdatedInstant(NodeId nodeId);
Madan Jampani7d2fab22015-03-18 17:21:57 -070089
90 /**
tomee49c372014-09-26 15:14:50 -070091 * Adds a new controller node to the cluster.
92 *
93 * @param nodeId controller node identifier
94 * @param ip node IP listen address
95 * @param tcpPort tcp listen port
96 * @return newly added node
97 */
Pavlin Radoslavov444b5192014-10-28 10:45:19 -070098 ControllerNode addNode(NodeId nodeId, IpAddress ip, int tcpPort);
tomee49c372014-09-26 15:14:50 -070099
100 /**
tomb41d1ac2014-09-24 01:51:24 -0700101 * Removes the specified node from the inventory of cluster nodes.
102 *
103 * @param nodeId controller instance identifier
104 */
105 void removeNode(NodeId nodeId);
106
tome4729872014-09-23 00:37:37 -0700107}