Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add (empty) ChangeLog entry for release 3.10.
[simgrid.git] / examples / bittorrent / TrackerTask.java
1 /*
2  * Copyright 2006-2012. The SimGrid Team. All rights reserved. 
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. 
6  */
7 package bittorrent;
8 import java.util.ArrayList;
9
10 import org.simgrid.msg.Task;
11
12 /**
13  * Task exchanged between the tracker
14  * and the peers. 
15  */
16 public class TrackerTask extends Task {
17         /**
18          * Type of the tasks
19          */
20         public enum Type {
21                 REQUEST,
22                 ANSWER
23         };
24         public Type type;
25         public String hostname;
26         public String mailbox;
27         public int peerId;
28         public int uploaded;
29         public int downloaded;
30         public int left;
31         public double interval;
32         public ArrayList<Integer> peers;
33         
34         public TrackerTask(String hostname, String mailbox, int peerId) {
35                 this(hostname, mailbox, peerId, 0, 0, Common.FILE_SIZE);
36         }       
37         public TrackerTask(String hostname, String mailbox, int peerId, int uploaded, int downloaded, int left) {
38                 super("", 0, Common.TRACKER_COMM_SIZE);
39                 this.type = Type.REQUEST;
40                 this.hostname = hostname;
41                 this.mailbox = mailbox;
42                 this.peerId = peerId;
43                 this.uploaded = uploaded;
44                 this.downloaded = downloaded;
45                 this.left = left;
46                 this.peers = new ArrayList<Integer>();
47         }
48         
49 }