blob: 6b09f9f4340560e3499d5030913adb5cee6471e3 [file] [log] [blame]
Andrew Brown3f2521a2015-01-17 22:10:15 -08001/*
andrewsbrown4feb2da2015-03-03 16:05:29 -08002 * jndn-utils
3 * Copyright (c) 2015, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU Lesser General Public License,
7 * version 3, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
12 * more details.
Andrew Brown3f2521a2015-01-17 22:10:15 -080013 */
14package com.intel.jndn.utils;
15
16import java.io.IOException;
andrewsbrown69d53292015-03-17 19:37:34 +010017import java.util.concurrent.Future;
Andrew Brown3f2521a2015-01-17 22:10:15 -080018import net.named_data.jndn.Data;
19import net.named_data.jndn.Face;
Andrew Brown3f2521a2015-01-17 22:10:15 -080020import net.named_data.jndn.Interest;
Andrew Brown3f2521a2015-01-17 22:10:15 -080021
22/**
andrewsbrown69d53292015-03-17 19:37:34 +010023 * Base functionality provided by all NDN clients in this package.
Andrew Brown3f2521a2015-01-17 22:10:15 -080024 *
25 * @author Andrew Brown <andrew.brown@intel.com>
26 */
andrewsbrown69d53292015-03-17 19:37:34 +010027public interface Client {
Andrew Brown3f2521a2015-01-17 22:10:15 -080028
Andrew Brown7b1daf32015-01-19 16:36:01 -080029 /**
andrewsbrown8372eaa2015-02-23 10:08:17 -080030 * Asynchronously request the Data for an Interest. This will send the
Andrew Browndb457052015-02-21 15:41:58 -080031 * Interest and return immediately; use futureData.get() to block until the
andrewsbrown69d53292015-03-17 19:37:34 +010032 * Data returns (see Future) or manage the event processing independently.
Andrew Browndb457052015-02-21 15:41:58 -080033 *
34 * @param face
35 * @param interest
36 * @return
37 */
andrewsbrown69d53292015-03-17 19:37:34 +010038 public Future<Data> getAsync(Face face, Interest interest);
Andrew Browndb457052015-02-21 15:41:58 -080039
40 /**
Andrew Brown7b1daf32015-01-19 16:36:01 -080041 * Synchronously retrieve the Data for an Interest; this will block until
42 * complete (i.e. either data is received or the interest times out).
43 *
44 * @param face
45 * @param interest
Andrew Brown7b1daf32015-01-19 16:36:01 -080046 * @return
andrewsbrown69d53292015-03-17 19:37:34 +010047 * @throws java.io.IOException
Andrew Brown7b1daf32015-01-19 16:36:01 -080048 */
andrewsbrown69d53292015-03-17 19:37:34 +010049 public Data getSync(Face face, Interest interest) throws IOException;
Andrew Brown3f2521a2015-01-17 22:10:15 -080050}