FiveGTopologyDatabase.java 2.89 KB
Newer Older
Björn Richerzhagen's avatar
Björn Richerzhagen committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
 *
 * This file is part of PeerfactSim.KOM.
 * 
 * PeerfactSim.KOM is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 * 
 * PeerfactSim.KOM is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with PeerfactSim.KOM.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

package de.tud.kom.p2psim.impl.topology.views.fiveg;

import de.tud.kom.p2psim.impl.topology.views.FiveGTopologyView;
import de.tud.kom.p2psim.impl.topology.views.FiveGTopologyView.CellLink;

/**
 * Database for the {@link FiveGTopologyView} - containing a mapping of
 * position IDs to the respective link characteristics.
 * 
 * @author Bjoern Richerzhagen
 * @version 1.0, Nov 5, 2015
 */
public interface FiveGTopologyDatabase {

	/**
	 * Calculation of a segment ID based on a position (usually given in
	 * Cartesian coordinates between 0 and WORLD_SIZE)
	 * 
	 * @param x
	 *            coordinate
	 * @param y
	 *            coordinate
	 * @return
	 */
	public int getSegmentID(double x, double y);

	/**
	 * Access to the {@link Entry} for a given segmentID. To allow distinction
	 * between clouds (full latency) and cloudlets (less latency, as the backend
	 * is "shorter"), we added a boolean "isCloudlet", which may or may not be
	 * used by the database. It is expected that the link to a cloudlet should
	 * outperform the link to a cloud.
	 * 
	 * @param segmentID
	 * @return
	 */
	public FiveGTopologyDatabase.Entry getEntryFor(int segmentID,
			boolean isCloudlet);

	/**
	 * Data structure for the network parameters of a given segment ID - these
	 * are directly accessed by the {@link CellLink} object on each call (so
	 * they should not perform expensive calculations!). We allow a distinction
	 * between up and download (from the client's perspective) via the provided
	 * boolean - upload means: from client to station, download means: from
	 * station to client.
	 * 
	 * @author Bjoern Richerzhagen
	 * @version 1.0, Nov 5, 2015
	 */
	public interface Entry {

		/**
		 * Static segment ID
		 * 
		 * @return
		 */
		public int getSegmentID();

		/**
		 * Probability of a packet drop on the link - can even be 1, so that the
		 * link is virtually disconnected.
		 * 
		 * @return
		 */
		public double getDropProbability(boolean isUpload);

		/**
		 * Latency on the link (RTT/2)
		 * 
		 * @return
		 */
		public long getLatency(boolean isUpload);

		/**
		 * Bandwidth on the link
		 * 
		 * @return
		 */
		public long getBandwidth(boolean isUpload);

	}

}