1 // -----------------------------------------------------------------------
2 // Copyright (C) 2006 - 2007 FRESCOR consortium partners:
4 // Universidad de Cantabria, SPAIN
5 // University of York, UK
6 // Scuola Superiore Sant'Anna, ITALY
7 // Kaiserslautern University, GERMANY
8 // Univ. Politécnica Valencia, SPAIN
9 // Czech Technical University in Prague, CZECH REPUBLIC
11 // Thales Communication S.A. FRANCE
12 // Visual Tools S.A. SPAIN
13 // Rapita Systems Ltd UK
16 // See http://www.frescor.org for a link to partners' websites
18 // FRESCOR project (FP6/2005/IST/5-034026) is funded
19 // in part by the European Union Sixth Framework Programme
20 // The European Union is not liable of any use that may be
24 // based on previous work (FSF) done in the FIRST project
26 // Copyright (C) 2005 Mälardalen University, SWEDEN
27 // Scuola Superiore S.Anna, ITALY
28 // Universidad de Cantabria, SPAIN
29 // University of York, UK
31 // FSF API web pages: http://marte.unican.es/fsf/docs
32 // http://shark.sssup.it/contrib/first/docs/
34 // This file is part of FRSH API
36 // FRSH API is free software; you can redistribute it and/or modify
37 // it under the terms of the GNU General Public License as published by
38 // the Free Software Foundation; either version 2, or (at your option)
41 // FRSH API is distributed in the hope that it will be useful, but
42 // WITHOUT ANY WARRANTY; without even the implied warranty of
43 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44 // General Public License for more details.
46 // You should have received a copy of the GNU General Public License
47 // distributed with FRSH API; see file COPYING. If not, write to the
48 // Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
51 // As a special exception, if you include this header file into source
52 // files to be compiled, this header file does not by itself cause
53 // the resulting executable to be covered by the GNU General Public
54 // License. This exception does not however invalidate any other
55 // reasons why the executable file might be covered by the GNU General
57 // -----------------------------------------------------------------------
58 //frsh_distributed_spare_capacity.h
59 //==============================================
60 // ******** ******* ******** ** **
61 // **///// /**////** **////// /** /**
62 // ** /** /** /** /** /**
63 // ******* /******* /********* /**********
64 // **//// /**///** ////////** /**//////**
65 // ** /** //** /** /** /**
66 // ** /** //** ******** /** /**
67 // // // // //////// // //
69 // FRSH(FRescor ScHeduler), pronounced "fresh"
70 //==============================================
71 #ifndef _FRSH_DISTRIBUTED_SPARE_CAPACITY_H_
72 #define _FRSH_DISTRIBUTED_SPARE_CAPACITY_H_
74 #include "frsh_core.h"
75 #include "frsh_distributed.h"
78 #define FRSH_DISTRIBUTED_SPARE_CAPACITY_MODULE_SUPPORTED 1
81 * @defgroup distribspare Distributed Spare Capacity
83 * This module adds spare-capacity/dynamic reclamation capabilities to
84 * the distributed module of FRSH.
90 * frsh_contract_set_granted_capacity_flag()
92 * This operation sets the granted capacity flag in the contract
93 * parameters object pointed to by contract to the boolean specified in
94 * granted_capacity_flag. This flag indicates to the scheduler that
95 * once the negotiation of the respective contract is finished, the
96 * first values for the budget and period given to the corresponding
97 * server must not be changed due to the negotiation or renegotiation
98 * of any other contract in the system. The period can change, though,
99 * if a renegotiation or a change of quality and importance is
100 * requested for the corresponding server It fails with
101 * FRSH_ERR_BAD_ARGUMENT if contract is NULL.
103 int frsh_contract_set_granted_capacity_flag
104 (frsh_contract_t *contract,
105 bool granted_capacity_flag);
108 * frsh_contract_get_granted_capacity_flag()
110 * This operation returns in the place pointed to by
111 * granted_capacity_flag the value of the corresponding flag in the
112 * contract parameters object pointed to by contract. It fails with
113 * FRSH_ERR_BAD_ARGUMENT if any of the pointers is NULL
115 int frsh_contract_get_granted_capacity_flag
116 (frsh_contract_t *contract,
117 bool *granted_capacity_flag);
120 * frsh_vres_set_capacity()
122 * This operation is used to return spare capacity that was assigned to
123 * a server but that cannot be used due to restrictions in other
124 * servers of a distributed transaction. This operation changes the
125 * cycle period and budget of the given server to the values given in
126 * new_period and new_budget, respectively. It fails with
127 * FRSH_ERR_BAD_ARGUMENT if the server does not have the
128 * granted_capacity flag set, if the new period is less than the
129 * current one, or if the new budget is larger than the current one. It
130 * also fails with the same error number if the new period is greater
131 * than the maximum period currently specified in the contract
132 * associated to the server or, similarly, if the new budget is smaller
133 * than the minimum budget in the contract. It also fails with the
134 * same number if the granularity is discrete and the new period and
135 * budget do not match any of the period-budget pairs in the
136 * utilization set of the server
138 int frsh_vres_set_capacity
139 (frsh_vres_id_t vres,
140 const struct timespec *new_period,
141 const struct timespec *new_budget);
144 #endif // _FRSH_DISTRIBUTED_SPARE_CAPACITY_H_