Search in sources :

Example 1 with StreamMetadata

use of org.apache.bookkeeper.stream.proto.StreamMetadata in project bookkeeper by apache.

the class MetaRangeImpl method loadStreamMetadata.

private void loadStreamMetadata(long streamId, byte[] streamMetadataBytes) {
    this.streamId = streamId;
    StreamMetadata metadata;
    try {
        metadata = StreamMetadata.parseFrom(streamMetadataBytes);
    } catch (InvalidProtocolBufferException e) {
        throw new RuntimeException("Invalid stream metadata of stream " + streamId, e);
    }
    this.streamProps = metadata.getProps();
    this.lifecycleState = metadata.getLifecycleState();
    this.servingState = metadata.getServingState();
    this.currentRanges.clear();
    this.currentRanges.addAll(metadata.getCurrentRangesList());
    this.nextRangeId = metadata.getNextRangeId();
    this.cTime = metadata.getCTime();
    this.mTime = metadata.getMTime();
}
Also used : StreamMetadata(org.apache.bookkeeper.stream.proto.StreamMetadata) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException)

Aggregations

InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 StreamMetadata (org.apache.bookkeeper.stream.proto.StreamMetadata)1