Package org.voltdb.catalog

Examples of org.voltdb.catalog.Cluster


     *
     * @param catalog
     * @return
     */
    public static Database getDatabase(CatalogType catalog_item) {
        Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
        assert (catalog_clus != null);
        return (catalog_clus.getDatabases().get(DEFAULT_DATABASE_NAME));
    }
View Full Code Here


     * @return
     */
    @Deprecated
    public static Site getSiteFromId(CatalogType catalog_item, int site_id) {
        assert (site_id >= 0);
        Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
        for (Site catalog_site : catalog_clus.getSites()) {
            if (catalog_site.getId() == site_id)
                return (catalog_site);
        } // FOR
        return (null);
    }
View Full Code Here

     * @param catalog_item
     * @return
     */
    @Deprecated
    public static int getNumberOfHosts(CatalogType catalog_item) {
        Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
        int ret = catalog_clus.getHosts().size();
        assert (ret > 0);
        return (ret);
    }
View Full Code Here

     * @param catalog_item
     * @return
     */
    @Deprecated
    public static int getNumberOfSites(CatalogType catalog_item) {
        Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
        int ret = catalog_clus.getSites().size();
        assert (ret > 0);
        return (ret);
    }
View Full Code Here

     * @param catalog_item
     * @return
     */
    @Deprecated
    public static int getNumberOfPartitions(CatalogType catalog_item) {
        Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
        int ret = catalog_clus.getNum_partitions();
        return (ret);
    }
View Full Code Here

        }
        return (false);
    }

    public static Collection<Site> getAllSites(CatalogType catalog_item) {
        Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
        return (catalog_clus.getSites());
    }
View Full Code Here

                public int compare(Site o1, Site o2) {
                    return (o1.getId() - o2.getId());
                }
            };

            Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
            for (Site catalog_site : catalog_clus.getSites()) {
                Host catalog_host = catalog_site.getHost();
                if (!sites.containsKey(catalog_host)) {
                    sites.put(catalog_host, new TreeSet<Site>(comparator));
                }
                sites.get(catalog_host).add(catalog_site);
                if (debug.val)
                    LOG.debug(catalog_host + " => " + catalog_site);
            } // FOR
            assert (sites.size() == catalog_clus.getHosts().size());
            if (debug.val)
                LOG.debug("HOST SITES: " + sites);
        }
        return (sites);
    }
View Full Code Here

     * @param catalog_host
     * @return
     */
    public static Collection<Site> getSitesForHost(Host catalog_host) {
        List<Site> sites = new ArrayList<Site>();
        Cluster cluster = (Cluster) catalog_host.getParent();
        for (Site catalog_site : cluster.getSites()) {
            if (catalog_site.getHost().getName().equals(catalog_host.getName()))
                sites.add(catalog_site);
        } // FOR
        // Sort them by id
        Collections.sort(sites, new CatalogFieldComparator<Site>("id"));
View Full Code Here

     * @param catalog_host
     * @return
     */
    public static Collection<Partition> getPartitionsForHost(Host catalog_host) {
        List<Partition> partitions = new ArrayList<Partition>();
        Cluster cluster = (Cluster) catalog_host.getParent();
        for (Site catalog_site : cluster.getSites()) {
            if (catalog_site.getHost().getName().equals(catalog_host.getName()))
                partitions.addAll(catalog_site.getPartitions());
        } // FOR
        return (partitions);
    }
View Full Code Here

    public static Map<Integer, Set<Pair<String, Integer>>> getExecutionSites(CatalogType catalog_item) {
        final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_item);
        final Map<Integer, Set<Pair<String, Integer>>> sites = cache.EXECUTION_SITES;

        if (sites.isEmpty()) {
            Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
            for (Site catalog_site : CatalogUtil.getSortedCatalogItems(catalog_clus.getSites(), "id")) {
                Host catalog_host = catalog_site.getHost();
                assert (catalog_host != null);
                Set<Pair<String, Integer>> s = new HashSet<Pair<String, Integer>>();
                for (Integer port : CatalogUtil.getExecutionSitePorts(catalog_site)) {
                    s.add(Pair.of(catalog_host.getIpaddr(), port));
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Cluster

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.