Search in sources :

Example 1 with IndexResult

use of org.yamcs.protobuf.Yamcs.IndexResult in project yamcs-studio by yamcs.

the class ArchiveIndexReceiver method getIndex.

public void getIndex(TimeInterval interval) {
    if (receiving) {
        log.info("already receiving data");
        return;
    }
    ArchiveCatalogue catalogue = ArchiveCatalogue.getInstance();
    catalogue.downloadIndexes(interval, data -> {
        try {
            IndexResult response = IndexResult.parseFrom(data);
            log.fine(String.format("Received %d archive records", response.getRecordsCount()));
            archiveView.receiveArchiveRecords(response);
        } catch (InvalidProtocolBufferException e) {
            throw new YamcsApiException("Failed to decode server message", e);
        }
    }).whenComplete((data, exc) -> {
        if (exc == null) {
            log.info("Done receiving archive records.");
            archiveView.receiveArchiveRecordsFinished();
            receiving = false;
        } else {
            archiveView.receiveArchiveRecordsError(exc.toString());
        }
    });
}
Also used : EditTagRequest(org.yamcs.protobuf.Rest.EditTagRequest) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) YamcsApiException(org.yamcs.api.YamcsApiException) ArchiveTag(org.yamcs.protobuf.Yamcs.ArchiveTag) TimeInterval(org.yamcs.studio.core.TimeInterval) TimeEncoding(org.yamcs.utils.TimeEncoding) ListTagsResponse(org.yamcs.protobuf.Rest.ListTagsResponse) Logger(java.util.logging.Logger) CreateTagRequest(org.yamcs.protobuf.Rest.CreateTagRequest) IndexResult(org.yamcs.protobuf.Yamcs.IndexResult) ArchiveCatalogue(org.yamcs.studio.core.model.ArchiveCatalogue) Level(java.util.logging.Level) YamcsApiException(org.yamcs.api.YamcsApiException) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) IndexResult(org.yamcs.protobuf.Yamcs.IndexResult) ArchiveCatalogue(org.yamcs.studio.core.model.ArchiveCatalogue)

Aggregations

InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 Level (java.util.logging.Level)1 Logger (java.util.logging.Logger)1 YamcsApiException (org.yamcs.api.YamcsApiException)1 CreateTagRequest (org.yamcs.protobuf.Rest.CreateTagRequest)1 EditTagRequest (org.yamcs.protobuf.Rest.EditTagRequest)1 ListTagsResponse (org.yamcs.protobuf.Rest.ListTagsResponse)1 ArchiveTag (org.yamcs.protobuf.Yamcs.ArchiveTag)1 IndexResult (org.yamcs.protobuf.Yamcs.IndexResult)1 TimeInterval (org.yamcs.studio.core.TimeInterval)1 ArchiveCatalogue (org.yamcs.studio.core.model.ArchiveCatalogue)1 TimeEncoding (org.yamcs.utils.TimeEncoding)1