use of io.pravega.client.netty.impl.RawClient in project pravega by pravega.
the class SegmentMetadataClientImpl method getPropertyAsync.
private CompletableFuture<WireCommands.SegmentAttribute> getPropertyAsync(UUID attributeId, String delegationToken) {
long requestId = requestIdGenerator.get();
log.debug("Getting segment attribute: {}", attributeId);
RawClient connection = getConnection();
return connection.sendRequest(requestId, new GetSegmentAttribute(requestId, segmentId.getScopedName(), attributeId, delegationToken)).thenApply(r -> transformReply(r, WireCommands.SegmentAttribute.class));
}
use of io.pravega.client.netty.impl.RawClient in project pravega by pravega.
the class SegmentMetadataClientImpl method updatePropertyAsync.
private CompletableFuture<SegmentAttributeUpdated> updatePropertyAsync(UUID attributeId, long expected, long value, String delegationToken) {
long requestId = requestIdGenerator.get();
log.trace("Updating segment attribute: {}", attributeId);
RawClient connection = getConnection();
return connection.sendRequest(requestId, new UpdateSegmentAttribute(requestId, segmentId.getScopedName(), attributeId, value, expected, delegationToken)).thenApply(r -> transformReply(r, SegmentAttributeUpdated.class));
}
use of io.pravega.client.netty.impl.RawClient in project pravega by pravega.
the class SegmentMetadataClientImpl method closeConnection.
private void closeConnection(Reply badReply) {
log.info("Closing connection as a result of receiving: {}", badReply);
RawClient c;
synchronized (lock) {
c = client;
client = null;
}
if (c != null) {
try {
c.close();
} catch (Exception e) {
log.warn("Exception tearing down connection: ", e);
}
}
}
use of io.pravega.client.netty.impl.RawClient in project pravega by pravega.
the class SegmentMetadataClientImpl method closeConnection.
private void closeConnection(Throwable exceptionToInflightRequests) {
log.info("Closing connection with exception: {}", exceptionToInflightRequests.getMessage());
RawClient c;
synchronized (lock) {
c = client;
client = null;
}
if (c != null) {
try {
c.close();
} catch (Exception e) {
log.warn("Exception tearing down connection: ", e);
}
}
}
use of io.pravega.client.netty.impl.RawClient in project pravega by pravega.
the class SegmentMetadataClientImpl method truncateSegmentAsync.
private CompletableFuture<SegmentTruncated> truncateSegmentAsync(Segment segment, long offset, String delegationToken) {
long requestId = requestIdGenerator.get();
log.trace("Truncating segment: {}", segment);
RawClient connection = getConnection();
return connection.sendRequest(requestId, new TruncateSegment(requestId, segment.getScopedName(), offset, delegationToken)).thenApply(r -> transformReply(r, SegmentTruncated.class));
}
Aggregations