blob: 0e33f2f0fece14f8a7128e7ace7e3441ebb16ff5 [file] [log] [blame]
Aaron Kruglikov2d69ca12017-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.incubator.grpc;
18
19import io.grpc.BindableService;
20
21/**
22 * A service that allows for de/registration of gRPC services, and determining
23 * whether a service is present.
24 */
25public interface GrpcServiceRegistry {
26 /**
27 * Register a gRPC service with this registry.
28 * @param service the service to be registered
29 * @return true if the service was added and server successfully started,
30 * false otherwise
31 */
32 boolean register(BindableService service);
33
34 /**
35 * Unregister a gRPC service with this registry.
36 * @param service the service to be unregistered
37 * @return true if the service was removed and the server successfully
38 * started, false otherwise
39 */
40 boolean unregister(BindableService service);
41
42 /**
43 * Checks if an instance of the provided serviceClass is currently
44 * registered with this registry.
45 * @param serviceClass the class being queries
46 * @return true if an instance of this specified class has been registered,
47 * false otherwise
48 */
49 boolean containsService(Class<BindableService> serviceClass);
50}