Statistics
| Branch: | Revision:

streamers / transaction.h @ f1bad954

History | View | Annotate | Download (1.17 KB)

1
/*
2
 *  Copyright (c) 2010 Stefano Traverso
3
 *  Copyright (c) 2010 Csaba Kiraly
4
 *
5
 *  This is free software; see gpl-3.0.txt
6
 */
7

    
8
#ifndef TRANSACTION_H
9
#define TRANSACTION_H
10

    
11
/* timeout of the offers thread. If it is not updated, it is deleted */
12
#define TRANS_ID_MAX_LIFETIME 1.5
13

    
14
// struct nodeID;
15

    
16
typedef struct {
17
        uint16_t trans_id;
18
        double offer_sent_time;
19
        double accept_received_time;
20
        struct nodeID *id;
21
        } service_time;
22

    
23

    
24
// List to trace peer's service times
25
struct service_times_element {
26
        service_time st;
27
        struct service_times_element *backward;
28
        struct service_times_element *forward;
29
        };
30

    
31
// register the moment when a transaction is started
32
// return a  new transaction id
33
uint16_t transaction_create(struct nodeID *id);
34

    
35
// Change transaction status when an accept has been received
36
bool transaction_change(uint16_t trans_id, struct nodeID *id);
37

    
38
// Used to get the time elapsed from the moment I get a positive select to the moment i get the ACK
39
// related to the same chunk
40
// it return -1.0 in case no trans_id is found
41
double transaction_remove(uint16_t trans_id);
42

    
43
// Check neighbor list to prune elapsed pending threads
44
void transactions_check();
45

    
46
#endif // TRANSACTION_H