blob: 5e7e4bcc817884e3ef3cb4687a1a52a5dce841a4 [file] [log] [blame]
Aaron Kruglikovae7e3b82017-05-03 14:13:53 -07001/*
2 * Copyright 2017-present Open Networking Foundation
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 */
16
17package org.onosproject.protobuf.api;
18
19import com.google.common.annotations.Beta;
20import io.grpc.BindableService;
21
22/**
23 * A service that allows for de/registration of gRPC services, and determining
24 * whether a service is present.
25 */
26@Beta
27public interface GrpcServiceRegistry {
28 /**
29 * Register a gRPC service with this registry.
30 * @param service the service to be registered
31 * @return true if the service was added and server successfully started,
32 * false otherwise
33 */
34 boolean register(BindableService service);
35
36 /**
37 * Unregister a gRPC service with this registry.
38 * @param service the service to be unregistered
39 * @return true if the service was removed and the server successfully
40 * started, false otherwise
41 */
42 boolean unregister(BindableService service);
43
44 /**
45 * Checks if an instance of the provided serviceClass is currently
46 * registered with this registry.
47 * @param serviceClass the class being queries
48 * @return true if an instance of this specified class has been registered,
49 * false otherwise
50 */
51 boolean containsService(Class<BindableService> serviceClass);
52}