Search in sources :

Example 1 with MetastorageViewWalker

use of org.apache.ignite.internal.managers.systemview.walker.MetastorageViewWalker in project ignite by apache.

the class GridCacheDatabaseSharedManager method registerSystemView.

/**
 * Registers system view.
 */
private void registerSystemView() {
    cctx.kernalContext().systemView().registerView(METASTORE_VIEW, METASTORE_VIEW_DESC, new MetastorageViewWalker(), () -> {
        try {
            List<MetastorageView> data = new ArrayList<>();
            metaStorage.iterate("", (key, valBytes) -> {
                try {
                    Serializable val = metaStorage.marshaller().unmarshal((byte[]) valBytes, U.gridClassLoader());
                    data.add(new MetastorageView(key, IgniteUtils.toStringSafe(val)));
                } catch (IgniteCheckedException ignored) {
                    data.add(new MetastorageView(key, "[Raw data. " + (((byte[]) valBytes).length + " bytes]")));
                }
            }, false);
            return data;
        } catch (IgniteCheckedException e) {
            log.warning("Metastore iteration error", e);
            return emptyList();
        }
    }, identity());
}
Also used : MetastorageView(org.apache.ignite.spi.systemview.view.MetastorageView) Serializable(java.io.Serializable) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) MetastorageViewWalker(org.apache.ignite.internal.managers.systemview.walker.MetastorageViewWalker) ArrayList(java.util.ArrayList)

Example 2 with MetastorageViewWalker

use of org.apache.ignite.internal.managers.systemview.walker.MetastorageViewWalker in project ignite by apache.

the class DistributedMetaStorageImpl method registerSystemView.

/**
 */
private void registerSystemView() {
    ctx.systemView().registerView(DISTRIBUTED_METASTORE_VIEW, DISTRIBUTED_METASTORE_VIEW_DESC, new MetastorageViewWalker(), () -> {
        try {
            List<MetastorageView> data = new ArrayList<>();
            iterate("", (key, val) -> data.add(new MetastorageView(key, IgniteUtils.toStringSafe(val))));
            return data;
        } catch (IgniteCheckedException e) {
            log.warning("Metastore iteration error", e);
            return Collections.emptyList();
        }
    }, identity());
}
Also used : MetastorageView(org.apache.ignite.spi.systemview.view.MetastorageView) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) MetastorageViewWalker(org.apache.ignite.internal.managers.systemview.walker.MetastorageViewWalker) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 MetastorageViewWalker (org.apache.ignite.internal.managers.systemview.walker.MetastorageViewWalker)2 MetastorageView (org.apache.ignite.spi.systemview.view.MetastorageView)2 Serializable (java.io.Serializable)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1