Search in sources :

Example 1 with StorageAdminService

use of org.onosproject.store.service.StorageAdminService in project onos by opennetworkinglab.

the class TransactionsCommand method doExecute.

@Override
protected void doExecute() {
    StorageAdminService storageAdminService = get(StorageAdminService.class);
    Collection<TransactionId> transactionIds = storageAdminService.getPendingTransactions();
    if (outputJson()) {
        print("%s", json(transactionIds));
    } else {
        transactionIds.forEach(id -> print("%s", id.toString()));
    }
}
Also used : StorageAdminService(org.onosproject.store.service.StorageAdminService) TransactionId(org.onosproject.store.primitives.TransactionId)

Example 2 with StorageAdminService

use of org.onosproject.store.service.StorageAdminService in project onos by opennetworkinglab.

the class MapsListCommand method doExecute.

@Override
protected void doExecute() {
    StorageAdminService storageAdminService = get(StorageAdminService.class);
    List<MapInfo> mapInfo = storageAdminService.getMapInfo();
    if (outputJson()) {
        print("%s", json(mapInfo));
    } else {
        displayMaps(mapInfo);
    }
}
Also used : MapInfo(org.onosproject.store.service.MapInfo) StorageAdminService(org.onosproject.store.service.StorageAdminService)

Example 3 with StorageAdminService

use of org.onosproject.store.service.StorageAdminService in project onos by opennetworkinglab.

the class QueuesListCommand method doExecute.

@Override
protected void doExecute() {
    StorageAdminService storageAdminService = get(StorageAdminService.class);
    Map<String, WorkQueueStats> queueStats = storageAdminService.getQueueStats();
    if (outputJson()) {
        ObjectMapper mapper = new ObjectMapper();
        ObjectNode jsonQueues = mapper.createObjectNode();
        queueStats.forEach((k, v) -> {
            ObjectNode jsonStats = jsonQueues.putObject(k);
            jsonStats.put("pending", v.totalPending());
            jsonStats.put("inProgress", v.totalInProgress());
            jsonStats.put("completed", v.totalCompleted());
        });
        print("%s", jsonQueues);
    } else {
        queueStats.forEach((name, stats) -> print(FMT, name, stats.totalPending(), stats.totalInProgress(), stats.totalCompleted()));
    }
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) WorkQueueStats(org.onosproject.store.service.WorkQueueStats) StorageAdminService(org.onosproject.store.service.StorageAdminService) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 4 with StorageAdminService

use of org.onosproject.store.service.StorageAdminService in project onos by opennetworkinglab.

the class CountersListCommand method doExecute.

@Override
protected void doExecute() {
    StorageAdminService storageAdminService = get(StorageAdminService.class);
    Map<String, Long> counters = storageAdminService.getCounters();
    if (outputJson()) {
        ObjectMapper mapper = new ObjectMapper();
        ObjectNode jsonCounters = mapper.createObjectNode();
        counters.forEach((k, v) -> jsonCounters.put(k, v));
        print("%s", jsonCounters);
    } else {
        counters.keySet().stream().sorted().forEach(name -> print(FMT, name, counters.get(name)));
    }
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) StorageAdminService(org.onosproject.store.service.StorageAdminService) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

StorageAdminService (org.onosproject.store.service.StorageAdminService)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 TransactionId (org.onosproject.store.primitives.TransactionId)1 MapInfo (org.onosproject.store.service.MapInfo)1 WorkQueueStats (org.onosproject.store.service.WorkQueueStats)1