blob: 99361d8a975c16240836431210b8487ab89f892a [file] [log] [blame]
Madan Jampaniec1df022015-10-13 21:23:03 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
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 */
16package org.onosproject.cluster;
17
18import java.util.Collection;
19
20import org.onosproject.store.Store;
21import org.onosproject.store.service.Versioned;
22
23/**
Madan Jampaniab7e7cd2016-01-14 14:02:32 -080024 * Manages persistence of {@link ClusterMetadata cluster metadata}; not intended for direct use.
Madan Jampaniec1df022015-10-13 21:23:03 -070025 */
26public interface ClusterMetadataStore extends Store<ClusterMetadataEvent, ClusterMetadataStoreDelegate> {
27
28 /**
29 * Returns the cluster metadata.
30 * <p>
Madan Jampaniab7e7cd2016-01-14 14:02:32 -080031 * The retuned metadata is encapsulated as a {@link Versioned versioned} and therefore has a specific version.
Madan Jampaniec1df022015-10-13 21:23:03 -070032 * @return cluster metadata
33 */
34 Versioned<ClusterMetadata> getClusterMetadata();
35
36 /**
37 * Updates the cluster metadata.
38 * @param metadata new metadata value
39 */
40 void setClusterMetadata(ClusterMetadata metadata);
41
Madan Jampaniab7e7cd2016-01-14 14:02:32 -080042 /**
43 * Adds a controller node to the list of active members for a partition.
44 * <p>
45 * Active members of a partition are those that are actively participating
46 * in the data replication protocol being employed. When a node first added
47 * to a partition, it is in a passive or catch up mode where it attempts to
48 * bring it self up to speed with other active members in the partition.
49 * @param partitionId partition identifier
50 * @param nodeId identifier of controller node
51 */
52 void addActivePartitionMember(PartitionId partitionId, NodeId nodeId);
Madan Jampaniec1df022015-10-13 21:23:03 -070053
54 /**
Madan Jampaniab7e7cd2016-01-14 14:02:32 -080055 * Removes a controller node from the list of active members for a partition.
Madan Jampaniec1df022015-10-13 21:23:03 -070056 * @param partitionId partition identifier
57 * @param nodeId id of controller node
58 */
Madan Jampaniab7e7cd2016-01-14 14:02:32 -080059 void removeActivePartitionMember(PartitionId partitionId, NodeId nodeId);
Madan Jampaniec1df022015-10-13 21:23:03 -070060
61 /**
Madan Jampaniab7e7cd2016-01-14 14:02:32 -080062 * Returns the collection of controller nodes that are the active members for a partition.
Madan Jampaniec1df022015-10-13 21:23:03 -070063 * <p>
Madan Jampaniab7e7cd2016-01-14 14:02:32 -080064 * Active members of a partition are typically those that are actively
65 * participating in the data replication protocol being employed. When
66 * a node first added to a partition, it is in a passive or catch up mode where
67 * it attempts to bring it self up to speed with other active members in the partition.
Madan Jampaniec1df022015-10-13 21:23:03 -070068 * <p>
Madan Jampaniab7e7cd2016-01-14 14:02:32 -080069 * <b>Note:</b>If is possible for this list to different from the list of partition members
70 * specified by cluster meta data. The discrepancy can arise due to the fact that
71 * adding/removing members from a partition requires a data hand-off mechanism to complete.
Madan Jampaniec1df022015-10-13 21:23:03 -070072 * @param partitionId partition identifier
Madan Jampaniab7e7cd2016-01-14 14:02:32 -080073 * @return identifiers of controller nodes that are active members
Madan Jampaniec1df022015-10-13 21:23:03 -070074 */
Madan Jampaniab7e7cd2016-01-14 14:02:32 -080075 Collection<NodeId> getActivePartitionMembers(PartitionId partitionId);
Madan Jampaniec1df022015-10-13 21:23:03 -070076}