Revision fc15b997 include/HostPool.h

View differences:

include/HostPool.h
87 87
    };
88 88

  
89 89
    /**
90
     * Get the 10 least monitored hosts
90
     * Get the least monitored hosts
91 91
     *   @param discovered hosts, map to store the retrieved hosts hids and
92 92
     *   hostnames
93 93
     *   @param host_limit max. number of hosts to monitor at a time
......
147 147
     */
148 148
    int dump(ostringstream& oss, const string& where);
149 149

  
150

  
150
    /* ---------------------------------------------------------------------- */
151 151
    /* ---------------------------------------------------------------------- */
152 152
    /* Methods for cluster management                                         */
153 153
    /* ---------------------------------------------------------------------- */
154
/*
155
    ClusterPool * cluster_pool()
156
    {
157
        return &cluster_pool;
158
    }
159
//*/
154
    /* ---------------------------------------------------------------------- */
160 155

  
161 156
    /**
162 157
     *  Returns true if the clid is an id for an existing cluster
......
164 159
     *
165 160
     *  @return true if the clid is an id for an existing cluster
166 161
     */
167
    bool exists_cluster(int clid)
162
   /* bool exists_cluster(int clid)
168 163
    {
169 164
        return cluster_pool.exists(clid);
170
    };
165
    };*/
171 166

  
172 167
    /**
173 168
     *  Allocates a new cluster in the pool
......
222 217

  
223 218
        it = cluster_pool.cluster_names.find(clid);
224 219

  
225
        if(it == cluster_pool.cluster_names.end())
220
        if (it == cluster_pool.cluster_names.end())
226 221
        {
227 222
            return -1;
228 223
        }
......
230 225
        return host->set_cluster( it->second );
231 226
    };
232 227

  
233

  
234 228
    /**
235
     *  Removes the host from the given cluster.
236
     *  The result is the same as assigning the host to
237
     *  the default cluster.
229
     *  Removes the host from the given cluster setting the default one.
238 230
     *    @param host The host to assign
239 231
     *
240 232
     *    @return 0 on success
241 233
     */
242
    int remove_cluster(Host* host)
234
    int set_default_cluster(Host* host)
243 235
    {
244
        // To remove a host from a cluster means
245
        // moving it to the default cluster.
246
        return set_cluster(host, 0);
236
        return host->set_cluster(ClusterPool::DEFAULT_CLUSTER_NAME);
247 237
    };
248 238

  
249 239
private:
250

  
251
    ClusterPool         cluster_pool;
252

  
240
    /**
241
     *  ClusterPool, clusters defined and persistance functionality
242
     */
243
    ClusterPool  cluster_pool;
253 244

  
254 245
    /**
255 246
     *  Factory method to produce Host objects

Also available in: Unified diff