lishuai | 2ddc469 | 2015-07-31 15:15:16 +0800 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.ovsdb.rfc.jsonrpc; |
| 17 | |
| 18 | import java.util.List; |
| 19 | |
| 20 | import org.onosproject.ovsdb.rfc.operations.Operation; |
| 21 | import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; |
| 22 | |
| 23 | import com.fasterxml.jackson.databind.JsonNode; |
| 24 | import com.google.common.util.concurrent.ListenableFuture; |
| 25 | |
| 26 | /** |
| 27 | * The following interface describe the RPC7047's methods that are supported. |
| 28 | */ |
| 29 | public interface OvsdbRPC { |
| 30 | |
| 31 | /** |
| 32 | * This operation retrieves a database-schema that describes hosted database |
| 33 | * db-name. |
| 34 | * @param dbnames database name |
| 35 | * @return ListenableFuture of JsonNode |
| 36 | */ |
| 37 | ListenableFuture<JsonNode> getSchema(List<String> dbnames); |
| 38 | |
| 39 | /** |
| 40 | * The "echo" method can be used by both clients and servers to verify the |
| 41 | * liveness of a database connection. |
| 42 | * @return return info |
| 43 | */ |
| 44 | ListenableFuture<List<String>> echo(); |
| 45 | |
| 46 | /** |
| 47 | * The "monitor" request enables a client to replicate tables or subsets of |
| 48 | * tables within an OVSDB database by requesting notifications of changes to |
| 49 | * those tables and by receiving the complete initial state of a table or a |
| 50 | * subset of a table. |
| 51 | * @param dbSchema databse schema |
| 52 | * @param monitorId a id for monitor |
| 53 | * @return ListenableFuture of JsonNode |
| 54 | */ |
| 55 | ListenableFuture<JsonNode> monitor(DatabaseSchema dbSchema, String monitorId); |
| 56 | |
| 57 | /** |
| 58 | * This operation retrieves an array whose elements are the names of the |
| 59 | * databases that can be accessed over this management protocol connection. |
| 60 | * @return database names |
| 61 | */ |
| 62 | ListenableFuture<List<String>> listDbs(); |
| 63 | |
| 64 | /** |
| 65 | * This RPC method causes the database server to execute a series of |
| 66 | * operations in the specified order on a given database. |
| 67 | * @param dbSchema database schema |
| 68 | * @param operations the operations to execute |
| 69 | * @return result the transact result |
| 70 | */ |
| 71 | ListenableFuture<List<JsonNode>> transact(DatabaseSchema dbSchema, |
| 72 | List<Operation> operations); |
| 73 | |
| 74 | } |