Statistics
| Branch: | Revision:

grapes / include / scheduler_ha.h @ b79c8e3a

History | View | Annotate | Download (5.42 KB)

1 4f4e8c34 Luca Abeni
#ifndef SCHEDULER_LA_H
2
#define SCHEDULER_LA_H
3
4
#include "scheduler_common.h"
5
6
/** @file scheduler_ha.h
7

8 b9e0d721 MarcoBiazzini
  @brief Scheduling functions for chunk and peer selection.
9 4f4e8c34 Luca Abeni

10
  The chunk & peer scheduler (or simply ``scheduler'') is
11
  responsible for selecting a list of peer-chunk pairs whenever chunks or trade
12
  messages are to be sent. It can e.g. select destination peers and chunks to be sent
13
  when push streaming is used, or the peer to request from and the list of chunks
14
  to ask for when pull mode operation is required.
15
  Note that in this design the scheduler has nothing to do with the timing (it
16
  does not decide when to send chunks, but only decides which chunks
17
  to send/reqest/offer/propose/accept and the destination/source peer).
18
  Hence, the scheduler is non-blocking and has to be invoked at the correct time.
19

20
  The scheduler uses:
21
        - information about the neighbourhood and its state: hence, it
22
   directly communicates with the NeighborhoodList;
23
        - information about the chunks currently contained in the chunk
24
   buffer: hence, it directly interacts with the chunk buffer.
25

26
*/
27
28
/**
29
  Initialize the scheduler
30

31
  @param[in] cfg configuration string
32
*/
33
int schedInit(char *cfg);
34
35
/**
36
  Select a list of peer-chunk pairs for sending.
37

38
  In a simple push model, chunks are sent to peers without further messaging. This selection function selects the chunk-peer
39
  pairs for this simple pull operation.
40

41
  @param[in] peers list of peers to choose from.
42
  @param[in] peers_len length of the peers list
43
  @param[in] chunks list of chunks to choose from.
44
  @param[in] chunks_len length of the chunks list
45
  @param[out] selected ordered list of peer-chunk pairs selected
46
  @param[in,out] selected_len in: maximum number of selectable pairs, also defines the allocated space for selected. out: length of the selected list
47
*/
48 0fb056cf Csaba Kiraly
void schedSelectPushList(schedPeerID  *peers, int peers_len, schedChunkID  *chunks, int chunks_len,         //in
49 4f4e8c34 Luca Abeni
                     struct PeerChunk *selected, int *selected_len);        //out, inout
50
51
/**
52
  Select what chunks to request from which peers.
53

54
  In a pull model, chunk requests shuold be explicitly signaled. This selection function serves to select the peer-chunk combinations for such
55
  requests. E.g. one well known implementation of this selection creates a partitioning of the missing chunk set and assigns a peer to each of
56
  these subsets.
57

58
  @param[in] peers list of peers to choose from.
59
  @param[in] peers_len length of the peers list
60
  @param[in] chunks list of chunks to choose from.
61
  @param[in] chunks_len length of the chunks list
62
  @param[out] selected ordered list of peer-chunk pairs selected
63
  @param[in,out] selected_len in: maximum number of selectable pairs, also defines the allocated space for selected. out: length of the selected list
64
*/
65 0fb056cf Csaba Kiraly
void schedSelectRequestList(schedPeerID  *peers, int peers_len, schedChunkID  *chunks, int chunks_len,         //in
66 4f4e8c34 Luca Abeni
                     struct PeerChunk *selected, int *selected_len);        //out, inout
67
68
69
/**
70
  Select what to offer based on the requests that arrived.
71

72
  In a simple pull model, all requests are served, therefore no selection is needed on the  sender side. In a more sophisicated model, the sender side should
73
  evaluate requests that have arrived and select the ones that are satisfied. This selection funciton is to 
74

75
  @param[in] peers list of peers to choose from.
76
  @param[in] peers_len length of the peers list
77
  @param[in] chunks list of chunks to choose from.
78
  @param[in] chunks_len length of the chunks list
79
  @param[out] selected ordered list of peer-chunk pairs selected
80
  @param[in,out] selected_len in: maximum number of OCselectable pairs, also defines the allocated space for selected. out: length of the selected list
81
*/
82 0fb056cf Csaba Kiraly
void schedSelectOfferList(schedPeerID  *peers, int peers_len, schedChunkID  *chunks, int chunks_len,         //in
83 4f4e8c34 Luca Abeni
                     struct PeerChunk *selected, int *selected_len);        //out, inout
84
85
/**
86
  Select chunks to propose to other peers.
87

88
  This selection function decides which chunks to propose to which peers. In this case first a decision is made at the peer initiating the transaction about
89
  the set of peers it is willing to send to the other peer. 
90

91
  @param[in] peers list of peers to choose from.
92
  @param[in] peers_len length of the peers list
93
  @param[in] chunks list of chunks to choose from.
94
  @param[in] chunks_len length of the chunks list
95
  @param[out] selected ordered list of peer-chunk pairs selected
96
  @param[in,out] selected_len in: maximum number of selectable pairs, also defines the allocated space for selected. out: length of the selected list
97
*/
98 0fb056cf Csaba Kiraly
void schedSelectProposeList(schedPeerID  *peers, int peers_len, schedChunkID  *chunks, int chunks_len,         //in
99 4f4e8c34 Luca Abeni
                     struct PeerChunk *selected, int *selected_len);        //out, inout
100
101
/**
102
  Select chunks to accept based on proposals.
103

104
  This selection function which proposed chunks to ask for.
105

106
  @param[in] peers list of peers to choose from.
107
  @param[in] peers_len length of the peers list
108
  @param[in] chunks list of chunks to choose from.
109
  @param[in] chunks_len length of the chunks list
110
  @param[out] selected ordered list of peer-chunk pairs selected
111
  @param[in,out] selected_len in: maximum number of selectable pairs, also defines the allocated space for selected. out: length of the selected list
112
*/
113 0fb056cf Csaba Kiraly
void schedSelectAcceptList(schedPeerID  *peers, int peers_len, schedChunkID  *chunks, int chunks_len,         //in
114 4f4e8c34 Luca Abeni
                     struct PeerChunk *selected, int *selected_len);        //out, inout
115
116
#endif /* SCHEDULER_LA_H */