1/*
2 * Copyright (C) 2018 The Android Open Source Project
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 [email protected];
18
19/**
20 * A connection to a buffer pool which handles requests from a buffer pool
21 * client. The connection must be made in order to receive buffers from
22 * other buffer pool clients.
23 */
24interface IConnection {
25
26    /**
27     * Retrieves a buffer using bufferId. The method must be called from
28     * receiving side of buffer during transferring only when the specified
29     * buffer is neither cached nor used. This fails if the specified
30     * transaction is not valid.
31     *
32     * @param transactionId Unique transaction id for buffer transferring.
33     * @param bufferId Id of the buffer to be fetched.
34     * @return status The status of the call.
35     *     OK               - A buffer was fetched successfully.
36     *     NO_MEMORY        - Memory allocation failure occurred.
37     *     NOT_FOUND        - A buffer was not found due to invalidation.
38     *     CRITICAL_ERROR   - Other errors.
39     * @return buffer The actual buffer which is specified with bufferId.
40     */
41    fetch(uint64_t transactionId, uint32_t bufferId) generates
42        (ResultStatus status, Buffer buffer);
43};
44