Scheduling functions for chunk and peer selection. More...
#include "scheduler_common.h"
Go to the source code of this file.
Functions | |
int | schedInit (char *cfg) |
void | schedSelectPushList (schedPeerID *peers, int peers_len, schedChunkID *chunks, int chunks_len, struct PeerChunk *selected, int *selected_len) |
void | schedSelectRequestList (schedPeerID *peers, int peers_len, schedChunkID *chunks, int chunks_len, struct PeerChunk *selected, int *selected_len) |
void | schedSelectOfferList (schedPeerID *peers, int peers_len, schedChunkID *chunks, int chunks_len, struct PeerChunk *selected, int *selected_len) |
void | schedSelectProposeList (schedPeerID *peers, int peers_len, schedChunkID *chunks, int chunks_len, struct PeerChunk *selected, int *selected_len) |
void | schedSelectAcceptList (schedPeerID *peers, int peers_len, schedChunkID *chunks, int chunks_len, struct PeerChunk *selected, int *selected_len) |
Scheduling functions for chunk and peer selection.
The chunk & peer scheduler (or simply ``scheduler'') is responsible for selecting a list of peer-chunk pairs whenever chunks or trade messages are to be sent. It can e.g. select destination peers and chunks to be sent when push streaming is used, or the peer to request from and the list of chunks to ask for when pull mode operation is required. Note that in this design the scheduler has nothing to do with the timing (it does not decide when to send chunks, but only decides which chunks to send/reqest/offer/propose/accept and the destination/source peer). Hence, the scheduler is non-blocking and has to be invoked at the correct time.
The scheduler uses:
int schedInit | ( | char * | cfg | ) |
Initialize the scheduler
[in] | cfg | configuration string |
void schedSelectAcceptList | ( | schedPeerID * | peers, | |
int | peers_len, | |||
schedChunkID * | chunks, | |||
int | chunks_len, | |||
struct PeerChunk * | selected, | |||
int * | selected_len | |||
) |
Select chunks to accept based on proposals.
This selection function which proposed chunks to ask for.
[in] | peers | list of peers to choose from. |
[in] | peers_len | length of the peers list |
[in] | chunks | list of chunks to choose from. |
[in] | chunks_len | length of the chunks list |
[out] | selected | ordered list of peer-chunk pairs selected |
[in,out] | selected_len | in: maximum number of selectable pairs, also defines the allocated space for selected. out: length of the selected list |
void schedSelectOfferList | ( | schedPeerID * | peers, | |
int | peers_len, | |||
schedChunkID * | chunks, | |||
int | chunks_len, | |||
struct PeerChunk * | selected, | |||
int * | selected_len | |||
) |
Select what to offer based on the requests that arrived.
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 evaluate requests that have arrived and select the ones that are satisfied. This selection funciton is to
[in] | peers | list of peers to choose from. |
[in] | peers_len | length of the peers list |
[in] | chunks | list of chunks to choose from. |
[in] | chunks_len | length of the chunks list |
[out] | selected | ordered list of peer-chunk pairs selected |
[in,out] | selected_len | in: maximum number of OCselectable pairs, also defines the allocated space for selected. out: length of the selected list |
void schedSelectProposeList | ( | schedPeerID * | peers, | |
int | peers_len, | |||
schedChunkID * | chunks, | |||
int | chunks_len, | |||
struct PeerChunk * | selected, | |||
int * | selected_len | |||
) |
Select chunks to propose to other peers.
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 the set of peers it is willing to send to the other peer.
[in] | peers | list of peers to choose from. |
[in] | peers_len | length of the peers list |
[in] | chunks | list of chunks to choose from. |
[in] | chunks_len | length of the chunks list |
[out] | selected | ordered list of peer-chunk pairs selected |
[in,out] | selected_len | in: maximum number of selectable pairs, also defines the allocated space for selected. out: length of the selected list |
void schedSelectPushList | ( | schedPeerID * | peers, | |
int | peers_len, | |||
schedChunkID * | chunks, | |||
int | chunks_len, | |||
struct PeerChunk * | selected, | |||
int * | selected_len | |||
) |
Select a list of peer-chunk pairs for sending.
In a simple push model, chunks are sent to peers without further messaging. This selection function selects the chunk-peer pairs for this simple pull operation.
[in] | peers | list of peers to choose from. |
[in] | peers_len | length of the peers list |
[in] | chunks | list of chunks to choose from. |
[in] | chunks_len | length of the chunks list |
[out] | selected | ordered list of peer-chunk pairs selected |
[in,out] | selected_len | in: maximum number of selectable pairs, also defines the allocated space for selected. out: length of the selected list |
void schedSelectRequestList | ( | schedPeerID * | peers, | |
int | peers_len, | |||
schedChunkID * | chunks, | |||
int | chunks_len, | |||
struct PeerChunk * | selected, | |||
int * | selected_len | |||
) |
Select what chunks to request from which peers.
In a pull model, chunk requests shuold be explicitly signaled. This selection function serves to select the peer-chunk combinations for such 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 these subsets.
[in] | peers | list of peers to choose from. |
[in] | peers_len | length of the peers list |
[in] | chunks | list of chunks to choose from. |
[in] | chunks_len | length of the chunks list |
[out] | selected | ordered list of peer-chunk pairs selected |
[in,out] | selected_len | in: maximum number of selectable pairs, also defines the allocated space for selected. out: length of the selected list |